26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
51 #pragma package(smart_init)
64 Graphics::TBitmap* SmallGraphicPtrVal) : SpeedTag(SpeedTagVal), TrackType(TrackTypeVal), GraphicPtr(GraphicPtrVal), SmallGraphicPtr(SmallGraphicPtrVal)
66 for(
int x = 0; x < 4; x++)
77 else if(SpeedTagVal == 77)
81 else if(SpeedTagVal == 78)
85 else if(SpeedTagVal == 79)
89 else if(SpeedTagVal == 96)
93 else if(SpeedTagVal == 129)
97 else if(SpeedTagVal == 130)
101 else if(SpeedTagVal == 131)
105 else if(SpeedTagVal == 145)
109 else if(SpeedTagVal == 146)
118 FixedNamedLocationElement(false)
120 for(
int x = 0; x < 4; x++)
131 AnsiString(VLocInput));
144 if((this->
HLoc == RHElement.
HLoc) && (this->VLoc == RHElement.
VLoc) && (this->SpeedTag == RHElement.
SpeedTag))
158 if((this->
HLoc != RHElement.
HLoc) || (this->VLoc != RHElement.
VLoc) || (this->SpeedTag != RHElement.
SpeedTag))
174 Graphics::TBitmap *GraphicOutput = GraphicPtr;
176 if(LocationName ==
"")
221 GraphicOutput = GraphicPtr;
225 Disp->PlotOutput(34, HLoc * 16, VLoc * 16, GraphicOutput);
227 if((TrackType ==
Simple) && Failed)
239 AnsiString LogString =
"TrkEl:-," + AnsiString(ElementID) +
"," + LocationName +
"," + AnsiString(TrainIDOnElement) +
"," +
240 AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit01) +
"," + AnsiString(TrainIDOnBridgeOrFailedPointOrigSpeedLimit23) +
",EndTrkEl,";
249 Attribute(0), CallingOnSet(false), Length01(
Utilities->DefaultTrackLength), Length23(-1), SpeedLimit01(
Utilities->DefaultTrackSpeedLimit), SpeedLimit23(-1),
250 TrainIDOnElement(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit01(-1), TrainIDOnBridgeOrFailedPointOrigSpeedLimit23(-1), StationEntryStopLinkPos1(-1),
251 StationEntryStopLinkPos2(-1), StationEntryStopLinkPos3(-1), StationEntryStopLinkPos4(-1), SigAspect(FourAspect)
254 for(
int x = 0; x < 4; x++)
270 if(lower.second < higher.second)
274 else if(lower.second > higher.second)
278 else if(lower.second == higher.second)
280 if(lower.first < higher.first)
293 :
TTrackElement(ElementIn), ELink(ELinkIn), ELinkPos(ELinkPosIn), XLink(XLinkIn), XLinkPos(XLinkPosIn), TrackVectorPosition(TrackVectorPositionIn),
294 CheckCount(9), IsARoute(false), AutoSignals(false), PrefDirRoute(false)
298 throw Exception(
"EXNumber failure in TPrefDirElement constructor");
309 AnsiString LogString =
"PthEl:-," + AnsiString(
ELink) +
"," + AnsiString(
ELinkPos) +
"," + AnsiString(
XLink) +
"," + AnsiString(
XLinkPos) +
"," +
337 {2, 4}, {6, 2}, {8, 6}, {4, 8},
338 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
348 else if(
Link[2] == -1)
361 else if(
Link[2] == -1)
370 for(
int x = 0; x < 16; x++)
372 if(((Entry == EXArray[x][0]) && (Exit == EXArray[x][1])) || ((Entry == EXArray[x][1]) && (Exit == EXArray[x][0])))
548 throw Exception(
"Error in EntryExitNumber 4");
643 throw Exception(
"Error in EntryExitNumber 5");
737 throw Exception(
"Error in EntryExitNumber 6");
824 throw Exception(
"Error in EntryExitNumber 10");
913 throw Exception(
"Error in EntryExitNumber 11");
1009 throw Exception(
"Error in EntryExitNumber 7");
1040 throw Exception(
"Error in EntryExitNumber 8");
1051 if((ELink > 0) && (ELink < 10) && (ELink != 5))
1053 if(!AutoSigsFlag && !PrefDirRoute)
1057 else if(!AutoSigsFlag && PrefDirRoute)
1068 throw Exception(
"Error in EntryExitNumber 9");
1165 AnsiString NL =
'\n';
1167 RouteFailMessage =
"Unable to set a route:" + NL + NL +
"it may be unreachable, perhaps because of failed points; " + NL + NL +
1168 "reachable but too far ahead or with too many different directions leading away from the start point - set some points on the route required; " + NL + NL +
1169 "blocked by a train, another route or a changing level crossing; " + NL + NL +
1170 "or invalid - possibly due to a preferred direction mismatch, or a missed signal in a blue route or green route restricted to consecutive signals.";
1177 int InternalLinkCheckArray[9][2] =
1178 {{1, 9}, {4, 6}, {7, 3}, {2, 8}, {0, 0}, {8, 2}, {3, 7}, {6, 4}, {9, 1}};
1183 for(
int x = 0; x < 9; x++)
1185 for(
int y = 0; y < 2; y++)
1192 TopPlatAllowed << 1 << 9 << 10 << 30 << 31 << 60 << 61 << 68 << 69 << 77 << 125 << 126 << 129 << 145;
1194 BotPlatAllowed << 1 << 7 << 8 << 28 << 29 << 60 << 61 << 68 << 69 << 76 << 125 << 126 << 129 << 145;
1195 LeftPlatAllowed << 2 << 12 << 14 << 33 << 35 << 62 << 63 << 70 << 71 << 79 << 127 << 128 << 130 << 146;
1196 RightPlatAllowed << 2 << 11 << 13 << 32 << 34 << 62 << 63 << 70 << 71 << 78 << 127 << 128 << 130 << 146;
1197 NameAllowed << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15 << 16 << 18 << 19 << 20 << 21 << 22 << 23 << 24
1198 << 25 << 26 << 27 << 28 << 29 << 30 << 31 << 32 << 33 << 34 << 35 << 36 << 37 << 38 << 39 << 40 << 41 << 42 << 43 << 44 << 45 << 46 << 47
1199 << 60 << 61 << 62 << 63 << 64 << 65 << 66 << 67 << 68 << 69 << 70 << 71 << 72 << 73 << 74 << 75 << 80 << 81 << 82 << 83 << 84 << 85 << 86
1200 << 87 << 125 << 126 << 127 << 128 << 132 << 133 << 134 << 135 << 136 << 137 << 138 << 139
1201 << 140 << 141 << 142 << 143;
1206 int HVArray[10][2] =
1207 {{0, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {0, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
1209 for(
int x = 0; x < 10; x++)
1211 for(
int y = 0; y < 2; y++)
1220 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1223 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1224 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1226 {68, 2,
RailGraphics->
bm68dblyellow}, {69, 2,
RailGraphics->
bm69dblyellow}, {70, 2,
RailGraphics->
bm70dblyellow}, {71, 2,
RailGraphics->
bm71dblyellow},
1227 {72, 2,
RailGraphics->
bm72dblyellow}, {73, 2,
RailGraphics->
bm73dblyellow}, {74, 2,
RailGraphics->
bm74dblyellow}, {75, 2,
RailGraphics->
bm75dblyellow},
1229 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1230 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1233 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1236 for(
int x = 0; x < 40; x++)
1242 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1245 {68, 1,
RailGraphics->
bm68yellow}, {69, 1,
RailGraphics->
bm69yellow}, {70, 1,
RailGraphics->
bm70yellow}, {71, 1,
RailGraphics->
bm71yellow},
1246 {72, 1,
RailGraphics->
bm72yellow}, {73, 1,
RailGraphics->
bm73yellow}, {74, 1,
RailGraphics->
bm74yellow}, {75, 1,
RailGraphics->
bm75yellow},
1248 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1249 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1251 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1252 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1255 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1258 for(
int x = 0; x < 40; x++)
1264 {{68, 0,
RailGraphics->
gl68}, {69, 0,
RailGraphics->
gl69}, {70, 0,
RailGraphics->
gl70}, {71, 0,
RailGraphics->
gl71}, {72, 0,
RailGraphics->
gl72},
1267 {68, 1,
RailGraphics->
bm68green}, {69, 1,
RailGraphics->
bm69green}, {70, 1,
RailGraphics->
bm70green}, {71, 1,
RailGraphics->
bm71green},
1268 {72, 1,
RailGraphics->
bm72green}, {73, 1,
RailGraphics->
bm73green}, {74, 1,
RailGraphics->
bm74green}, {75, 1,
RailGraphics->
bm75green},
1270 {68, 2,
RailGraphics->
bm68green}, {69, 2,
RailGraphics->
bm69green}, {70, 2,
RailGraphics->
bm70green}, {71, 2,
RailGraphics->
bm71green},
1271 {72, 2,
RailGraphics->
bm72green}, {73, 2,
RailGraphics->
bm73green}, {74, 2,
RailGraphics->
bm74green}, {75, 2,
RailGraphics->
bm75green},
1273 {68, 3,
RailGraphics->
bm68green}, {69, 3,
RailGraphics->
bm69green}, {70, 3,
RailGraphics->
bm70green}, {71, 3,
RailGraphics->
bm71green},
1274 {72, 3,
RailGraphics->
bm72green}, {73, 3,
RailGraphics->
bm73green}, {74, 3,
RailGraphics->
bm74green}, {75, 3,
RailGraphics->
bm75green},
1277 {70, 4,
RailGraphics->
gl70}, {71, 4,
RailGraphics->
gl71}, {72, 4,
RailGraphics->
gl72}, {73, 4,
RailGraphics->
bm73}, {74, 4,
RailGraphics->
bm74},
1280 for(
int x = 0; x < 40; x++)
1306 for(
int x = 0; x < 40; x++)
1312 {{68, 0,
RailGraphics->
FSig68}, {69, 0,
RailGraphics->
FSig69}, {70, 0,
RailGraphics->
FSig70}, {71, 0,
RailGraphics->
FSig71}, {72, 0,
RailGraphics->
FSig72},
1315 for(
int x = 0; x < 8; x++)
1321 {{68, 0,
RailGraphics->
FGSig68}, {69, 0,
RailGraphics->
FGSig69}, {70, 0,
RailGraphics->
FGSig70}, {71, 0,
RailGraphics->
FGSig71}, {72, 0,
RailGraphics->
FGSig72},
1324 for(
int x = 0; x < 8; x++)
1351 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1352 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1353 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {0, 0, 77}, {-1, 0, 78},
1354 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1355 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, -1, 129},
1356 {0, 0, 129}, {0, -1, 145},
1359 for(
int x = 0; x < 25; x++)
1361 for(
int y = 0; y < 3; y++)
1369 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1370 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {0, 0, 76}, {-1, 0, 77},
1371 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1372 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1373 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1374 {0, 0, 129}, {0, 1, 145},
1377 for(
int x = 0; x < 25; x++)
1379 for(
int y = 0; y < 3; y++)
1387 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1388 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1389 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1390 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1391 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 0, 79}, {-1, 0, 130},
1392 {0, 0, 130}, {-1, 0, 146},
1395 for(
int x = 0; x < 25; x++)
1397 for(
int y = 0; y < 3; y++)
1405 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1406 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1407 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1408 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {0, 0, 78}, {-1, 0, 79},
1409 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {1, 0, 130},
1410 {0, 0, 130}, {1, 0, 146},
1413 for(
int x = 0; x < 25; x++)
1415 for(
int y = 0; y < 3; y++)
1423 {1, 0, 96}, {0, -1, 96}, {0, 1, 96}, {-1, 0, 76},
1424 {1, 0, 76}, {0, -1, 76}, {0, 1, 76}, {-1, 0, 77},
1425 {1, 0, 77}, {0, -1, 77}, {0, 1, 77}, {-1, 0, 78},
1426 {1, 0, 78}, {0, -1, 78}, {0, 1, 78}, {-1, 0, 79},
1427 {1, 0, 79}, {0, -1, 79}, {0, 1, 79}, {0, 1, 129},
1428 {0, -1, 129}, {1, 0, 130},
1429 {-1, 0, 130}, {0, 1, 145},
1430 {0, -1, 145}, {1, 0, 146},
1433 for(
int x = 0; x < 28; x++)
1435 for(
int y = 0; y < 3; y++)
1453 for(
int x = 0; x < 8; x++)
1455 for(
int y = 0; y < 3; y++)
1473 for(
int x = 0; x < 8; x++)
1475 for(
int y = 0; y < 3; y++)
1493 for(
int x = 0; x < 8; x++)
1495 for(
int y = 0; y < 3; y++)
1513 for(
int x = 0; x < 8; x++)
1515 for(
int y = 0; y < 3; y++)
1523 {1, 0, 131}, {0, -1, 131}, {0, 1, 131}};
1525 for(
int x = 0; x < 4; x++)
1527 for(
int y = 0; y < 3; y++)
1535 0, 1, 2, 5, 6, 3, 4, 9, 10, 7, 8, 13, 14, 11, 12, 15, 16, 17, 19, 18, 22, 23, 20, 21, 26, 27, 24, 25, 30, 31, 28, 29, 34, 35, 32, 33, 38, 39, 36, 37, 42,
1536 43, 40, 41, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 60, 61, 63, 62, 66, 67, 64, 65, 68, 69, 71, 70, 74, 75, 72, 73, 77, 76, 78,
1537 79, 80, 81, 83, 82, 86, 87, 84, 85, 88, 89, 91, 90, 94, 95, 92, 93, 96, 99, 100, 97, 98, 103, 104, 101, 102, 106, 105, 109, 110, 107, 108, 113, 114,
1538 111, 112, 117, 118, 115, 116, 119, 120, 121, 123, 122, 124, 125, 126, 128, 127, 129, 130, 131, 134, 133, 132, 135, 139, 138, 137, 136, 143, 142, 141,
1544 0, 1, 2, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 15, 16, 17, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 37, 36, 39, 38, 41,
1545 40, 43, 42, 45, 44, 47, 46, 48, 49, 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 62, 63, 65, 64, 67, 66, 69, 68, 70, 71, 73, 72, 75, 74, 76, 77, 79,
1546 78, 81, 80, 82, 83, 85, 84, 87, 86, 89, 88, 90, 91, 93, 92, 95, 94, 96, 98, 97, 100, 99, 102, 101, 104, 103, 106, 105, 108, 107, 110, 109, 112, 111,
1547 114, 113, 116, 115, 118, 117, 119, 120, 124, 122, 123, 121, 126, 125, 127, 128, 129, 130, 131, 132, 135, 134, 133, 137, 136, 139, 138, 142, 143, 140,
1553 0, 2, 1, 4, 6, 3, 5, 14, 12, 13, 11, 7, 9, 8, 10, 15, 16, 17, 19, 18, 25, 27, 24, 26, 21, 23, 20, 22, 35, 33, 34, 32, 28, 30, 29, 31, 41, 43, 40, 42, 37,
1554 39, 36, 38, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 63, 62, 60, 61, 65, 67, 64, 66, 71, 70, 68, 69, 73, 75, 72, 74, 79, 78, 76,
1555 77, 83, 82, 80, 81, 85, 87, 84, 86, 91, 90, 88, 89, 93, 95, 92, 94, 96, 102, 104, 101, 103, 98, 100, 97, 99, 106, 105, 108, 110, 107, 109, 116, 118,
1556 115, 117, 112, 114, 111, 113, 120, 119, 122, 124, 121, 123, 127, 128, 126, 125, 130, 129, 131, 133, 134, 135, 132, 137, 138, 139, 136, 143, 142, 140,
1562 0, 2, 1, 5, 3, 6, 4, 11, 13, 12, 14, 10, 8, 9, 7, 15, 16, 17, 19, 18, 26, 24, 27, 25, 22, 20, 23, 21, 32, 34, 33, 35, 31, 29, 30, 28, 42, 40, 43, 41, 38,
1563 36, 39, 37, 46, 47, 44, 45, 49, 48, 51, 50, 56, 57, 58, 59, 52, 53, 54, 55, 62, 63, 61, 60, 66, 64, 67, 65, 70, 71, 69, 68, 74, 72, 75, 73, 78, 79, 77,
1564 76, 82, 83, 81, 80, 86, 84, 87, 85, 90, 91, 89, 88, 94, 92, 95, 93, 96, 103, 101, 104, 102, 99, 97, 100, 98, 106, 105, 109, 107, 110, 108, 117, 115,
1565 118, 116, 113, 111, 114, 112, 120, 119, 123, 121, 124, 122, 128, 127, 125, 126, 130, 129, 131, 135, 132, 133, 134, 139, 136, 137, 138, 142, 143, 141,
1587 delete UGMIt->second;
1663 Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
Simple,
1664 Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
Points,
1666 Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
Bridge,
1673 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1674 Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
Parapet,
1687 {4, 6, -1, -1}, {2, 8, -1, -1}, {6, 8, -1, -1}, {4, 8, -1, -1}, {2, 6, -1, -1}, {2, 4, -1, -1},
1688 {4, 6, 4, 2}, {6, 4, 6, 2}, {4, 6, 4, 8}, {6, 4, 6, 8}, {8, 2, 8, 4}, {8, 2, 8, 6}, {2, 8, 2, 4}, {2, 8, 2, 6},
1690 {4, 6, 2, 8}, {1, 9, 3, 7},
1692 {3, 7, -1, -1}, {1, 9, -1, -1}, {7, 6, -1, -1}, {4, 9, -1, -1}, {1, 6, -1, -1}, {4, 3, -1, -1}, {3, 8, -1, -1}, {1, 8, -1, -1}, {2, 9, -1, -1},
1694 {4, 6, 4, 3}, {6, 4, 6, 1}, {4, 6, 4, 9}, {6, 4, 6, 7}, {8, 2, 8, 1}, {8, 2, 8, 3}, {2, 8, 2, 7}, {2, 8, 2, 9}, {9, 1, 9, 2}, {7, 3, 7, 2}, {3, 7, 3, 8}, {1, 9, 1, 8}, {9, 1, 9, 4}, {7, 3, 7, 6}, {3, 7, 3, 4}, {1, 9, 1, 6},
1697 {1, 9, 2, 8}, {2, 8, 3, 7}, {4, 6, 3, 7}, {1, 9, 4, 6},
1698 {2, 8, 4, 6}, {4, 6, 2, 8}, {3, 7, 1, 9}, {1, 9, 3, 7}, {2, 8, 1, 9}, {2, 8, 3, 7}, {3, 7, 2, 8}, {1, 9, 2, 8}, {4, 6, 3, 7}, {4, 6, 1, 9}, {1, 9, 4, 6}, {3, 7, 4, 6},
1699 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1700 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1},
1701 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1702 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1703 {4, 6, -1, -1}, {6, 4, -1, -1}, {8, 2, -1, -1}, {2, 8, -1, -1}, {1, 9, -1, -1}, {3, 7, -1, -1}, {7, 3, -1, -1}, {9, 1, -1, -1},
1705 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1706 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1707 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1708 {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1}, {-1, -1, -1, -1},
1709 {4, 6, -1, -1}, {4, 6, -1, -1}, {2, 8, -1, -1}, {2, 8, -1, -1},
1710 {4, 6, -1, -1}, {2, 8, -1, -1},
1712 {8, 1, 8, 3}, {4, 3, 4, 9}, {2, 9, 2, 7}, {6, 7, 6, 1}, {9, 4, 9, 2}, {7, 2, 7, 6}, {1, 6, 1, 8}, {3, 8, 3, 4},
1714 {3, 7, -1, -1}, {3, 7, -1, -1}, {1, 9, -1, -1}, {1, 9, -1, -1},
1716 {4, 6, -1, -1}, {2, 8, -1, -1},
1721 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1722 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1723 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1724 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1727 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1728 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1729 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1731 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1732 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1733 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1735 {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn}, {
CrossConn,
CrossConn,
CrossConn,
CrossConn},
1737 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1738 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1739 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1740 {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under}, {
Connection,
Connection,
Under,
Under},
1741 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1742 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1743 {
Connection,
Signal,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1744 {
Signal,
Connection,
NotSet,
NotSet}, {
Signal,
Connection,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet}, {
Connection,
Signal,
NotSet,
NotSet},
1745 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1746 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1747 {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet}, {
End,
Connection,
NotSet,
NotSet},
1748 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1749 {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet}, {
Gap,
Connection,
NotSet,
NotSet},
1751 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1752 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1753 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1754 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1755 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1756 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1757 {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet}, {
NotSet,
NotSet,
NotSet,
NotSet},
1758 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1762 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1763 {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail}, {
Lead,
Trail,
Lead,
Trail},
1764 {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet}, {
Connection,
Connection,
NotSet,
NotSet},
1770 for(
int x = 0; x < 17; x++)
1772 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1774 FixedTrackPiece[17] =
TFixedTrackPiece(17, TrackTypeArray[17], Links[17], Configs[17], 0, 0);
1778 FixedTrackPiece[x] =
TFixedTrackPiece(x, TrackTypeArray[x], Links[x], Configs[x], TrackImageArray[x], SmallTrackImageArray[x]);
1784 ExistingGraphicLoaded(false), Width(16), Height(16)
1796 ExistingGraphicLoaded(false), Width(WidthIn), Height(HeightIn)
1834 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalScreenGraphic()");
1838 throw Exception(
"Overlay not 16x16 in TGraphicElement::LoadOriginalScreenGraphic()");
1842 throw Exception(
"Source not set in TGraphicElement::LoadOriginalScreenGraphic()");
1846 throw Exception(
"ExistingGraphicLoaded in TGraphicElement::LoadOriginalScreenGraphic()");
1869 AnsiString(VOffset) +
"," + AnsiString(WidthIn) +
"," + AnsiString(HeightIn));
1872 throw Exception(
"Overlay not loaded in TGraphicElement::LoadOriginalExistingGraphic()");
1876 throw Exception(
"Source not set in TGraphicElement::LoadOriginalExistingGraphic()");
1880 throw Exception(
"ScreenGraphicLoaded in TGraphicElement::LoadOriginalExistingGraphic()");
1914 throw Exception(
"Overlay not loaded in TGraphicElement::PlotOverlay()");
1935 throw Exception(
"Original not loaded in TGraphicElement::PlotOriginal()");
1949 bool TrackPresent =
false;
1963 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1967 TrackPresent =
true;
1972 return(!TrackPresent);
1980 bool TrackPresent =
false;
1989 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
1993 TrackPresent =
true;
1999 return(!TrackPresent);
2004 void TTrack::EraseTrackElement(
int Caller,
int HLocInput,
int VLocInput,
int &ErasedTrackVectorPosition,
bool &TrackEraseSuccessfulFlag,
bool InternalChecks)
2007 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2008 TrackEraseSuccessfulFlag =
false;
2013 ErasedTrackVectorPosition = -1;
2014 AnsiString SName =
"", ErrorString;
2016 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
2022 TrackMapKeyPair.first = HLocInput;
2023 TrackMapKeyPair.second = VLocInput;
2024 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
2035 if(ErrorString !=
"")
2037 throw Exception(ErrorString +
" for EraseTrackElement 1");
2061 ErasedTrackVectorPosition = VecPos;
2062 TrackEraseSuccessfulFlag =
true;
2068 unsigned int VecPos;
2069 InactiveTrackMapKeyPair.first = HLocInput;
2070 InactiveTrackMapKeyPair.second = VLocInput;
2075 VecPos = InactiveTrack2MultiMapIterator->second;
2080 if(ErrorString !=
"")
2082 throw Exception(ErrorString +
" for EraseTrackElement 2A");
2092 TrackEraseSuccessfulFlag =
true;
2113 VecPos = InactiveTrack2MultiMapIterator->second;
2118 if(ErrorString !=
"")
2120 throw Exception(ErrorString +
" for EraseTrackElement 2B");
2144 if(TrackEraseSuccessfulFlag)
2160 void TTrack::PlotAndAddTrackElement(
int Caller,
int CurrentTag,
int Aspect,
int HLocInput,
int VLocInput,
bool &TrackLinkingRequiredFlag,
bool InternalChecks,
bool PerformNameSearch)
2167 AnsiString(HLocInput) +
"," + AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2168 bool PlatAllowedFlag =
false;
2170 TrackLinkingRequiredFlag =
false;
2182 LocationNameEntry.first =
"";
2190 TempTrackElement.
HLoc = HLocInput;
2191 TempTrackElement.
VLoc = VLocInput;
2217 else if(Aspect == 1)
2221 else if(Aspect == 2)
2225 else if(Aspect == 3)
2234 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2237 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2239 if(InactiveFoundFlag)
2243 NonStationOrLevelCrossingPresent =
true;
2247 NonStationOrLevelCrossingPresent =
true;
2251 PlatformPresent =
true;
2262 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2270 PlatAllowedFlag =
true;
2274 PlatAllowedFlag =
true;
2278 PlatAllowedFlag =
true;
2282 PlatAllowedFlag =
true;
2286 TrackLinkingRequiredFlag =
true;
2288 if(PerformNameSearch)
2317 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1048, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2318 (!FoundFlag && !InactiveFoundFlag))
2321 TrackLinkingRequiredFlag =
true;
2323 if(PerformNameSearch)
2356 TrackLinkingRequiredFlag =
true;
2368 else if(FoundFlag || InactiveFoundFlag)
2381 if(PerformNameSearch)
2390 bool BothPointFillets =
true;
2405 TrackLinkingRequiredFlag =
true;
2407 if(InternalChecks && PerformNameSearch)
2419 bool InternalChecks)
2423 AnsiString(VLocInput) +
"," + AnsiString((
short)InternalChecks));
2424 bool PlatAllowedFlag =
false;
2426 TrackLinkingRequiredFlag =
false;
2429 LocationNameEntry.first =
"";
2435 TempTrackElement.
HLoc = HLocInput;
2436 TempTrackElement.
VLoc = VLocInput;
2437 bool FoundFlag =
false, InactiveFoundFlag =
false, NonStationOrLevelCrossingPresent =
false, PlatformPresent =
false;
2438 for(
int x = 0; x < 4; x++)
2444 TempTrackElement.
Conn[x] = -1;
2458 int InactiveSpeedTag1 = 0, InactiveSpeedTag2 = 0;
2460 if(InactiveFoundFlag)
2464 NonStationOrLevelCrossingPresent =
true;
2468 NonStationOrLevelCrossingPresent =
true;
2472 PlatformPresent =
true;
2483 if(InactiveFoundFlag && ((TempTrackElement.
SpeedTag == InactiveSpeedTag1) || (TempTrackElement.
SpeedTag == InactiveSpeedTag2)))
2491 PlatAllowedFlag =
true;
2495 PlatAllowedFlag =
true;
2499 PlatAllowedFlag =
true;
2503 PlatAllowedFlag =
true;
2507 TrackLinkingRequiredFlag =
true;
2538 if((FoundFlag && (
NameAllowed.Contains(
TrackElementAt(1055, VecPos).SpeedTag)) && !PlatformPresent && !InactiveFoundFlag) ||
2539 (!FoundFlag && !InactiveFoundFlag))
2542 TrackLinkingRequiredFlag =
true;
2579 TrackLinkingRequiredFlag =
true;
2591 else if(FoundFlag || InactiveFoundFlag)
2610 bool BothPointFillets =
true;
2625 TrackLinkingRequiredFlag =
true;
2655 ShowMessage(
"Gaps must be set before track can be validated");
2665 throw Exception(
"Error, gaps unset when TryToConnectTrack called");
2676 if(!
LinkTrack(1, LocError, HLoc, VLoc,
false))
2693 ShowMessage(
"Error in RepositionAndMapTrack during TryToConnectTrack. Railway file is corrupt, further use may cause a system crash");
2700 if(!
LinkTrack(2, LocError, HLoc, VLoc,
true))
2724 std::pair<AnsiString, char>TempMapPair;
2732 TempMapPair.second =
'x';
2742 AnsiString Name =
"";
2743 typedef std::list<AnsiString> TNoPlatsList;
2744 TNoPlatsList::iterator NPLIt;
2745 TNoPlatsList NoPlatsList;
2746 typedef std::list<AnsiString> TLocNameList;
2747 TLocNameList LocNameList;
2752 LocNameList.push_back(LNMMIt->first);
2755 LocNameList.unique();
2756 for(TLocNameList::iterator LNLIt = LocNameList.begin(); LNLIt != LocNameList.end(); LNLIt++)
2760 if(MMRange.first == MMRange.second)
2766 if((LNMMIt->second) < 0)
2780 TempIt = MMRange.second;
2781 if(LNMMIt == --TempIt)
2783 NoPlatsList.push_back(Name);
2787 if(!NoPlatsList.empty())
2789 AnsiString NoPlatsAnsiList =
"";
2790 for(NPLIt = NoPlatsList.begin(); NPLIt != NoPlatsList.end(); NPLIt++)
2792 NoPlatsAnsiList += *NPLIt +
'\n';
2796 if(NoPlatsList.size() > 1)
2798 ShowMessage(
"Please note: the following locations have no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2802 ShowMessage(
"Please note: the following location has no platforms, trains won't be able to stop or pass there:-\n\n" + NoPlatsAnsiList +
"\nThis message will not be shown again.");
2817 int NewHLoc, NewVLoc;
2818 bool ConnectionFoundFlag, LinkFoundFlag;
2820 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2822 for(
unsigned int y = 0; y < 4; y++)
2840 ConnectionFoundFlag =
false;
2841 for(
unsigned int z = 0; z <
TrackVector.size(); z++)
2847 ConnectionFoundFlag =
true;
2849 LinkFoundFlag =
false;
2850 for(
unsigned int a = 0; a < 4; a++)
2854 LinkFoundFlag =
true;
2870 if(!ConnectionFoundFlag)
2945 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2962 bool UnsetGaps =
false;
2969 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
2973 for(
unsigned int y = 0; y < 4; y++)
2985 for(
unsigned int y = 0; y < 4; y++)
2995 for(
unsigned int y = 1; y < 4; y++)
3004 for(
unsigned int y = 0; y < 4; y++)
3017 for(
unsigned int y = 0; y < 4; y++)
3045 int NumberOfActiveElements = 0;
3047 GraphicsFollow =
false;
3051 if(MarkerString[MarkerString.Length()] ==
'1')
3053 GraphicsFollow =
true;
3055 for(
int x = 0; x < NumberOfActiveElements; x++)
3061 TrackElement.
HLoc = TempInt;
3063 TrackElement.
VLoc = TempInt;
3069 TrackElement.
Conn[0] = TempInt;
3093 if((TempInt != -1) && (TempInt < 10))
3103 if((TempInt != -1) && (TempInt < 10))
3120 if(Marker[1] ==
'3')
3124 else if(Marker[1] ==
'2')
3128 else if(Marker[1] ==
'G')
3142 int NumberOfInactiveElements = 0;
3146 for(
int x = 0; x < NumberOfInactiveElements; x++)
3152 TrackElement.
HLoc = TempInt;
3154 TrackElement.
VLoc = TempInt;
3160 bool LocError =
false;
3189 for(
int x = 0; x < NumberOfGraphics; x++)
3200 bool FileError =
false;
3202 for(
int x = 0; x < NumberOfGraphics; x++)
3215 UGME.second =
new TPicture;
3216 UGME.second->LoadFromFile(
UGME.first);
3219 throw Exception(
"Map Insertion Error 2 - UserGraphicMap insertion failure for " + UGI.
FileName);
3226 catch(
const EInvalidGraphic &e)
3235 delete UGMIt->second;
3240 catch(
const Exception &e)
3249 delete UGMIt->second;
3257 bool FoundInMap =
false;
3276 UGME.second =
new TPicture;
3277 UGME.second->LoadFromFile(
UGME.first);
3280 throw Exception(
"Map Insertion Error 3 - UserGraphicMap insertion failure for " + UGI.
FileName);
3287 catch(
const EInvalidGraphic &e)
3296 delete UGMIt->second;
3301 catch(
const Exception &e)
3310 delete UGMIt->second;
3335 VecFile <<
"**Active elements**1" <<
'\0' <<
'\n';
3339 VecFile <<
"**Active elements**" <<
'\0' <<
'\n';
3341 for(
unsigned int x = 0; x < (
TrackVector.size()); x++)
3344 VecFile << x <<
'\n';
3345 VecFile << TrackElement.
SpeedTag <<
'\n';
3346 VecFile << TrackElement.
HLoc <<
'\n';
3347 VecFile << TrackElement.
VLoc <<
'\n';
3351 VecFile << TrackElement.
Conn[0] <<
'\n';
3355 VecFile << TrackElement.
Attribute <<
'\n';
3361 VecFile << int(1) <<
'\n';
3365 VecFile << int(0) <<
'\n';
3368 VecFile << TrackElement.
Length01 <<
'\n';
3369 VecFile << TrackElement.
Length23 <<
'\n';
3372 VecFile << TrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3379 VecFile <<
"3*****" <<
'\0' <<
'\n';
3383 VecFile <<
"2*****" <<
'\0' <<
'\n';
3387 VecFile <<
"G*****" <<
'\0' <<
'\n';
3391 VecFile <<
"4*****" <<
'\0' <<
'\n';
3396 VecFile <<
"******" <<
'\0' <<
'\n';
3401 VecFile <<
"**Inactive elements**" <<
'\0' <<
'\n';
3405 VecFile << x <<
'\n';
3406 VecFile << InactiveTrackElement.
SpeedTag <<
'\n';
3407 VecFile << InactiveTrackElement.
HLoc <<
'\n';
3408 VecFile << InactiveTrackElement.
VLoc <<
'\n';
3409 VecFile << InactiveTrackElement.
LocationName.c_str() <<
'\0' <<
'\n';
3410 VecFile <<
"******" <<
'\0' <<
'\n';
3425 GraphicsFollow =
false;
3427 if((NumberOfActiveElements < 0) || (NumberOfActiveElements > 1000000))
3433 AnsiString MarkerString;
3440 if(MarkerString[MarkerString.Length()] ==
'1')
3442 GraphicsFollow =
true;
3444 for(
int x = 0; x < NumberOfActiveElements; x++)
3452 int SpeedTag = TempInt;
3459 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3465 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3470 if((SpeedTag > 87) && (SpeedTag < 96))
3473 if((TempInt < -1) || (TempInt > 3))
3479 if((TempInt < -1) || (TempInt > 999999))
3485 if(((SpeedTag >= 7) && (SpeedTag <= 14)) || ((SpeedTag >= 28) && (SpeedTag <= 43)) || ((SpeedTag >= 132) && (SpeedTag <= 139)) ||
3486 ((SpeedTag >= 68) && (SpeedTag <= 75)))
3489 if((TempInt < -1) || (TempInt > 5))
3495 if((SpeedTag >= 68) && (SpeedTag <= 75))
3498 if((TempInt != 0) && (TempInt != 1))
3505 if((TempInt < -1) || (TempInt > 999999))
3511 if((TempInt < -1) || (TempInt > 999999))
3517 if((TempInt < -1) || (TempInt > 999999))
3523 if((TempInt < -1) || (TempInt > 999999))
3544 int NumberOfInactiveElements = 0;
3547 if(NumberOfInactiveElements < 0)
3557 for(
int x = 0; x < NumberOfInactiveElements; x++)
3571 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3577 if(((TempInt > 999999) || (TempInt < -1000001)) && (TempInt != -2000000000))
3604 if((NumberOfGraphics < 0) || (NumberOfGraphics > 100000))
3610 AnsiString FileName =
"", TempStr =
"";
3612 for(
int x = 0; x < NumberOfGraphics; x++)
3614 TPicture *TempPicture =
new TPicture;
3623 TempPicture->LoadFromFile(GraphicsPath +
"\\" + FileName);
3636 catch(
const EInvalidGraphic &e)
3641 for(
int y = x + 1; y < NumberOfGraphics; y++)
3647 ShowMessage(FileName +
3648 " has an incorrect file format, user graphics can't be loaded. Ensure that all user graphic files are valid with extension .bmp, .gif, .jpg, or .png");
3653 catch(
const Exception &e)
3658 for(
int y = x + 1; y < NumberOfGraphics; y++)
3664 ShowMessage(
"Unable to load user graphic files, ensure that " + FileName +
3665 " exists in the 'Graphics' folder and that it is has extension .bmp, .gif, .jpg, or .png.");
3683 for(
int x = 0; x < VecSize; x++)
3706 for(
int x = 0; x < VecSize; x++)
3728 for(
int x = 0; x < VecSize; x++)
3782 for(
int x = 0; x < VecSize; x++)
3840 PlotPoints(5, Next, Disp, BothPointFilletsAndBasicLCs);
3862 if(BothPointFilletsAndBasicLCs)
3937 Bitmap->Canvas->CopyMode = cmSrcCopy;
3939 Graphics::TBitmap *GraphicOutput;
4114 for(
int x = 0; x < 40; x++)
4143 Graphics::TBitmap *GraphicPtr;
4158 Graphics::TBitmap* SignalPlatformGraphic;
4191 if(OldTransparentColour !=
clB5G5R5)
4214 Bitmap->Canvas->CopyMode = cmSrcCopy;
4242 Bitmap->Canvas->CopyMode = cmSrcCopy;
4244 Graphics::TBitmap *GraphicOutput;
4254 if(BaseElement == 1)
4350 for(
int x = 0; x < 40; x++)
4379 Graphics::TBitmap *GraphicPtr;
4394 Graphics::TBitmap* SignalPlatformGraphic;
4457 for(
int x = 0; x < 40; x++)
4465 Graphics::TBitmap* SignalPlatformGraphic;
4506 if(OldTransparentColour !=
clB5G5R5)
4520 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4592 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4606 ShowMessage(
"Error - gap connected to a non-gap. Railway file is corrupt, further use may cause a system crash");
4632 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4657 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4687 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4721 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4758 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4775 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4796 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4828 for(TrackMapPtr =
TrackMap.begin(); TrackMapPtr !=
TrackMap.end(); TrackMapPtr++)
4835 throw Exception(
"Error - Map & Vector different sizes");
4837 unsigned int NonZeroCount = 0;
4839 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4848 throw Exception(
"Error - NewVector & NonZero TrackVector different sizes");
4854 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4858 TrackMapEntry.first = TrackMapKeyPair;
4859 TrackMapEntry.second = x;
4860 if(!(
TrackMap.insert(TrackMapEntry).second))
4862 throw Exception(
"Error - map insertion failure, TrackVector in error");
4866 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4868 for(
unsigned int y = 0; y < 4; y++)
4893 THVPair GapMapKeyPair, GapMapValuePair;
4896 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4902 GapMapEntry.first = GapMapKeyPair;
4905 throw Exception(
"Error - Gap connection == -1 Can't build GapMap");
4909 GapMapEntry.second = GapMapValuePair;
4912 GapMap.insert(GapMapEntry);
4927 bool TrackElementPositionsOK =
true;
4929 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
4941 "Footbridge or underpass connection error. Each end must connect to a platform, concourse "
4942 "or other footbridge or underpass, and they can't connect to each other (i.e. a footbridge "
4943 "can't connect to an underpass or vice versa)");
4951 for(
unsigned int y = 0; y < 4; y++)
4969 bool ConnectionFoundFlag;
4973 ShowMessage(
"Can't have a track element adjacent to a continuation exit");
4979 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
4988 if(ConnectionFoundFlag)
4993 bool ExitSignal =
false;
5004 ShowMessage(
"Can't have an exit signal next to a level crossing - it can cause the train to foul the crossing in some circumstances");
5006 TrackElementPositionsOK =
false;
5011 ShowMessage(
"Can't have points, crossover or signal next to buffers - need room for a train without fouling");
5013 TrackElementPositionsOK =
false;
5018 ShowMessage(
"Can't have points, crossover, bridge or signal next to a continuation - it can cause route setting problems");
5022 TrackElementPositionsOK =
false;
5027 ShowMessage(
"Can't have two same-direction signals adjacent to each other as there is no room for a train between them");
5030 TrackElementPositionsOK =
false;
5042 ShowMessage(
"Bridge next to a signal - routes can't be truncated to this or other such signals.\n\nThis restriction can be removed or reinstated by pressing\nCTRL ALT 5. When removed this message will not be shown again.");
5045 TrackElementPositionsOK =
false;
5050 ShowMessage(
"Can't have two level crossings adjacent to each other on the same track");
5051 TrackElementPositionsOK =
false;
5054 if(!TrackElementPositionsOK)
5061 throw Exception(
"Error in track element positions in FinalCall");
5074 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5080 for(
unsigned int y = 0; y < 4; y++)
5102 bool ConnectionFoundFlag;
5103 bool LinkMatchFound =
false;
5106 if(ConnectionFoundFlag)
5108 for(
unsigned int a = 0; a < 4; a++)
5114 LinkMatchFound =
true;
5125 throw Exception(
"Error in final track linkage - - no matching link found");
5138 throw Exception(
"Error in final track linkage - connection not found");
5154 bool ConnErrorFlag =
false;
5156 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5160 ConnErrorFlag =
true;
5164 ConnErrorFlag =
true;
5168 ConnErrorFlag =
true;
5172 ConnErrorFlag =
true;
5181 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5190 throw Exception(
"ConnError in LinkTrack - Final");
5194 throw Exception(
"ConnError in LinkTrack - Precheck");
5197 bool CLkErrorFlag =
false;
5199 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5203 CLkErrorFlag =
true;
5207 CLkErrorFlag =
true;
5211 CLkErrorFlag =
true;
5215 CLkErrorFlag =
true;
5223 throw Exception(
"CLkError in LinkTrack - Final");
5227 throw Exception(
"CLkError in LinkTrack - Precheck");
5232 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5262 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5278 for(
unsigned int y = 0; y < 4; y++)
5297 bool ConnectionFoundFlag;
5303 throw Exception(
"Error in final track linkage - continuation adjacent to another element");
5312 if(ConnectionFoundFlag)
5315 bool LinkFoundFlag =
false;
5372 for(
unsigned int a = 0; a < 4; a++)
5381 LinkFoundFlag =
true;
5389 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - invalid link");
5399 throw Exception(
"Error in final track linkage in LinkTrackNoMessages - connection not found");
5413 bool ConnErrorFlag =
false;
5415 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5419 ConnErrorFlag =
true;
5423 ConnErrorFlag =
true;
5427 ConnErrorFlag =
true;
5431 ConnErrorFlag =
true;
5440 throw Exception(
"Error, StationEntryStopLinkPos not -1 for unnamed element at TrackVectorPosition = " + AnsiString(x));
5449 throw Exception(
"ConnError in LinkTrack - Final");
5453 throw Exception(
"ConnError in LinkTrack - Precheck");
5456 bool CLkErrorFlag =
false;
5458 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5462 CLkErrorFlag =
true;
5466 CLkErrorFlag =
true;
5470 CLkErrorFlag =
true;
5474 CLkErrorFlag =
true;
5482 throw Exception(
"CLkError in LinkTrack - Final");
5486 throw Exception(
"CLkError in LinkTrack - Precheck");
5490 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5519 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5535 for(
unsigned int y = 0; y < 4; y++)
5554 bool ConnectionFoundFlag =
false;
5556 if(ConnectionFoundFlag)
5560 bool LinkFoundFlag =
false;
5580 for(
unsigned int a = 0; a < 4; a++)
5589 LinkFoundFlag =
true;
5609 bool ConnErrorFlag =
false;
5611 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5615 ConnErrorFlag =
true;
5619 ConnErrorFlag =
true;
5623 ConnErrorFlag =
true;
5627 ConnErrorFlag =
true;
5635 bool CLkErrorFlag =
false;
5637 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
5641 CLkErrorFlag =
true;
5645 CLkErrorFlag =
true;
5649 CLkErrorFlag =
true;
5653 CLkErrorFlag =
true;
5671 int Position1, Position2;
5677 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
5679 int HLoc1 = GapMapPtr->first.first;
5680 int VLoc1 = GapMapPtr->first.second;
5681 int HLoc2 = GapMapPtr->second.first;
5682 int VLoc2 = GapMapPtr->second.second;
5685 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
5689 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
5693 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
5697 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
5715 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
5716 THVPair TrackMapKeyPair, InactiveTrackMapKeyPair;
5726 bool FoundFlag =
false;
5738 InactiveTrackMapKeyPair.first = TrackElement.
HLoc;
5739 InactiveTrackMapKeyPair.second = TrackElement.
VLoc;
5740 InactiveTrackMapEntry.first = InactiveTrackMapKeyPair;
5769 bool FoundFlag =
false;
5782 TrackMapKeyPair.first = TrackElement.
HLoc;
5783 TrackMapKeyPair.second = TrackElement.
VLoc;
5784 TrackMapEntry.first = TrackMapKeyPair;
5789 LocationNameEntry.second = -(int)(
TrackVector.size());
5829 TrackMapKeyPair.first = HLoc;
5830 TrackMapKeyPair.second = VLoc;
5831 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5841 return(TrackMapPtr->second);
5854 TrackMapKeyPair.first = HLoc;
5855 TrackMapKeyPair.second = VLoc;
5856 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5859 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5860 throw Exception(Message);
5878 MapKeyPair.first = HLoc;
5879 MapKeyPair.second = VLoc;
5880 MapPtr = Map.find(MapKeyPair);
5881 if(MapPtr == Map.end())
5883 AnsiString Message =
"Element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc) +
" in GetTrackElementFromAnyTrackMap";
5884 throw Exception(Message);
5889 return(Vector.at(MapPtr->second));
5899 THVPair InactiveTrackMapKeyPair;
5902 InactiveTrackMapKeyPair.first = HLoc;
5903 InactiveTrackMapKeyPair.second = VLoc;
5907 AnsiString Message =
"Inactive element not found at HLoc " + AnsiString(HLoc) +
" and VLoc " + AnsiString(VLoc);
5908 throw Exception(Message);
5922 bool Present =
true;
5926 TrackMapKeyPair.first = HLoc;
5927 TrackMapKeyPair.second = VLoc;
5928 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
5943 bool Present =
true;
5944 THVPair InactiveTrackMapKeyPair;
5947 InactiveTrackMapKeyPair.first = HLoc;
5948 InactiveTrackMapKeyPair.second = VLoc;
5966 THVPair InactiveTrackMapKeyPair;
5971 InactiveTrackMapKeyPair.first = HLoc;
5972 InactiveTrackMapKeyPair.second = VLoc;
5981 if(InactiveTrackRange.first == InactiveTrackRange.second)
5990 RetPair.first = InactiveTrackRange.first->second;
5991 RetPair.second = (--InactiveTrackRange.second)->second;
6004 AnsiString(DivergingPosition));
6015 if(((SpeedTag1 == 7) && (SpeedTag2 == 10)) ||
6016 ((SpeedTag1 == 10) && (SpeedTag2 == 7)) || ((SpeedTag1 == 8) && (SpeedTag2 == 9)) || ((SpeedTag1 == 9) && (SpeedTag2 == 8)) ||
6017 ((SpeedTag1 == 11) && (SpeedTag2 == 14)) ||
6018 ((SpeedTag1 == 14) && (SpeedTag2 == 11)) || ((SpeedTag1 == 12) && (SpeedTag2 == 13)) || ((SpeedTag1 == 13) && (SpeedTag2 == 12)) ||
6019 ((SpeedTag1 == 28) && (SpeedTag2 == 31)) ||
6020 ((SpeedTag1 == 31) && (SpeedTag2 == 28)) || ((SpeedTag1 == 29) && (SpeedTag2 == 30)) || ((SpeedTag1 == 30) && (SpeedTag2 == 29)) ||
6021 ((SpeedTag1 == 32) && (SpeedTag2 == 35)) ||
6022 ((SpeedTag1 == 35) && (SpeedTag2 == 32)) || ((SpeedTag1 == 33) && (SpeedTag2 == 34)) || ((SpeedTag1 == 34) && (SpeedTag2 == 33)) ||
6023 ((SpeedTag1 == 36) && (SpeedTag2 == 39)) ||
6024 ((SpeedTag1 == 39) && (SpeedTag2 == 36)) || ((SpeedTag1 == 37) && (SpeedTag2 == 38)) || ((SpeedTag1 == 38) && (SpeedTag2 == 37)) ||
6025 ((SpeedTag1 == 40) && (SpeedTag2 == 43)) ||
6026 ((SpeedTag1 == 43) && (SpeedTag2 == 40)) || ((SpeedTag1 == 41) && (SpeedTag2 == 42)) || ((SpeedTag1 == 42) && (SpeedTag2 == 41)))
6060 throw Exception(
"Error, Wrong track type in PlotGap");
6062 if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] > -1))
6066 else if((TrackElement.
SpeedTag == 88) && (TrackElement.
Conn[0] == -1))
6070 if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] > -1))
6074 else if((TrackElement.
SpeedTag == 89) && (TrackElement.
Conn[0] == -1))
6078 if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] > -1))
6082 else if((TrackElement.
SpeedTag == 90) && (TrackElement.
Conn[0] == -1))
6086 if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] > -1))
6090 else if((TrackElement.
SpeedTag == 91) && (TrackElement.
Conn[0] == -1))
6094 if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] > -1))
6098 else if((TrackElement.
SpeedTag == 92) && (TrackElement.
Conn[0] == -1))
6102 if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] > -1))
6106 else if((TrackElement.
SpeedTag == 93) && (TrackElement.
Conn[0] == -1))
6110 if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] > -1))
6114 else if((TrackElement.
SpeedTag == 94) && (TrackElement.
Conn[0] == -1))
6118 if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] > -1))
6122 else if((TrackElement.
SpeedTag == 95) && (TrackElement.
Conn[0] == -1))
6138 PosPair.first = TrackElement.
HLoc;
6139 PosPair.second = TrackElement.
VLoc;
6143 Disp->
PlotOutput(283, TrackElement.
HLoc * 16, TrackElement.
VLoc * 16, MOMIt->second);
6156 throw Exception(
"Error, Wrong track type in PlotPoints");
6160 bool FoundFlag =
false;
6162 if(IMPair.first > 0)
6178 else if(TrackElement.
SpeedTag < 132)
6189 else if(!TrackElement.
Failed)
6196 else if(TrackElement.
SpeedTag < 132)
6214 else if(TrackElement.
SpeedTag < 132)
6228 bool BlueLoc =
false;
6237 if(FoundFlag && !BlueLoc)
6254 throw Exception(
"Error, Wrong track type in PlotSignal");
6258 for(
int x = 0; x < 40; x++)
6329 for(
int x = 0; x < 40; x++)
6336 Graphics::TBitmap* SignalPlatformGraphic;
6351 for(
int x = 0; x < 8; x++)
6366 for(
int x = 0; x < 8; x++)
6457 while(
IsLCAtHV(0, HLoc, (VLoc + UpStep)))
6465 while(
IsLCAtHV(1, HLoc, (VLoc + DownStep)))
6473 while(
IsLCAtHV(2, (HLoc + LeftStep), VLoc))
6481 while(
IsLCAtHV(3, (HLoc + RightStep), VLoc))
6497 while(
IsLCAtHV(51, HLoc, (VLoc + UpStep)))
6505 while(
IsLCAtHV(52, HLoc, (VLoc + DownStep)))
6513 while(
IsLCAtHV(53, (HLoc + LeftStep), VLoc))
6521 while(
IsLCAtHV(54, (HLoc + RightStep), VLoc))
6554 while(
IsLCAtHV(55, HLoc, (VLoc + UpStep)))
6566 while(
IsLCAtHV(56, HLoc, (VLoc + DownStep)))
6578 while(
IsLCAtHV(57, (HLoc + LeftStep), VLoc))
6590 while(
IsLCAtHV(58, (HLoc + RightStep), VLoc))
6632 throw Exception(
"Error, Wrong track type in PlotAndLowerLevelCrossingBarriers");
6634 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
6636 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndLowerLevelCrossingBarriers");
6639 if(BaseElementSpeedTag == 1)
6643 while(
IsLCAtHV(5, HLoc, (VLoc + UpStep)))
6650 while(
IsLCAtHV(6, HLoc, (VLoc + DownStep)))
6658 Graphics::TBitmap *RouteGraphic;
6660 if(TypeOfRoute == 1)
6664 else if(TypeOfRoute == 0)
6670 RouteGraphic = BaseGraphic;
6677 if(UpStep == DownStep)
6680 Disp->
PlotOutput(133, HLoc * 16, VLoc * 16, RouteGraphic);
6690 else if((DownStep - UpStep) == 1)
6695 Disp->
PlotOutput(136, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6705 Disp->
PlotOutput(139, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6718 Disp->
PlotOutput(196, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6728 Disp->
PlotOutput(199, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6744 Disp->
PlotOutput(142, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
6754 Disp->
PlotOutput(145, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6764 else if(DownStep == 0)
6767 Disp->
PlotOutput(202, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6777 Disp->
PlotOutput(205, HLoc * 16, (VLoc + DownStep) * 16, RouteGraphic);
6790 Disp->
PlotOutput(208, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
6800 Disp->
PlotOutput(211, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
6810 for(
int x = (UpStep + 1); x < DownStep; x++)
6815 Disp->
PlotOutput(148, HLoc * 16, (VLoc + x) * 16, RouteGraphic);
6819 Disp->
PlotOutput(213, HLoc * 16, (VLoc + x) * 16, BaseGraphic);
6840 while(
IsLCAtHV(7, (HLoc + LStep), VLoc))
6847 while(
IsLCAtHV(8, (HLoc + RStep), VLoc))
6853 Graphics::TBitmap *RouteGraphic;
6855 if(TypeOfRoute == 1)
6859 else if(TypeOfRoute == 0)
6865 RouteGraphic = BaseGraphic;
6874 Disp->
PlotOutput(151, HLoc * 16, VLoc * 16, RouteGraphic);
6884 else if((RStep - LStep) == 1)
6889 Disp->
PlotOutput(154, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6899 Disp->
PlotOutput(157, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6912 Disp->
PlotOutput(215, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6922 Disp->
PlotOutput(218, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6938 Disp->
PlotOutput(160, (HLoc + LStep) * 16, VLoc * 16, RouteGraphic);
6948 Disp->
PlotOutput(163, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
6961 Disp->
PlotOutput(221, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6971 Disp->
PlotOutput(224, (HLoc + RStep) * 16, VLoc * 16, RouteGraphic);
6984 Disp->
PlotOutput(227, (HLoc + LStep) * 16, VLoc * 16, BaseGraphic);
6994 Disp->
PlotOutput(230, (HLoc + RStep) * 16, VLoc * 16, BaseGraphic);
7004 for(
int x = (LStep + 1); x < RStep; x++)
7009 Disp->
PlotOutput(166, (HLoc + x) * 16, VLoc * 16, RouteGraphic);
7013 Disp->
PlotOutput(232, (HLoc + x) * 16, VLoc * 16, BaseGraphic);
7037 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7040 throw Exception(
"Error, Wrong track type in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
7042 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7044 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainLoweredLinkedLevelCrossingBarriersAndSetMarkers");
7047 if(BaseElementSpeedTag == 1)
7051 while(
IsLCAtHV(30, HLoc, (VLoc + UpStep)))
7058 while(
IsLCAtHV(31, HLoc, (VLoc + DownStep)))
7064 if(UpStep == DownStep)
7075 else if((DownStep - UpStep) == 1)
7094 for(
int x = (UpStep + 1); x < DownStep; x++)
7103 for(
int x = (UpStep + 1); x < DownStep; x++)
7110 for(
int x = UpStep; x <= DownStep; x++)
7123 while(
IsLCAtHV(32, (HLoc + LStep), VLoc))
7130 while(
IsLCAtHV(33, (HLoc + RStep), VLoc))
7147 else if((RStep - LStep) == 1)
7166 for(
int x = (LStep + 1); x < RStep; x++)
7175 for(
int x = (LStep + 1); x < RStep; x++)
7182 for(
int x = LStep; x <= RStep; x++)
7201 throw Exception(
"Error, Wrong track type in PlotAndRaiseLevelCrossingBarriers");
7203 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7205 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotAndRaiseLevelCrossingBarriers");
7208 if(BaseElementSpeedTag == 1)
7212 while(
IsLCAtHV(10, HLoc, (VLoc + UpStep)))
7219 while(
IsLCAtHV(11, HLoc, (VLoc + DownStep)))
7225 for(
int x = UpStep; x < (DownStep + 1); x++)
7240 while(
IsLCAtHV(12, (HLoc + LStep), VLoc))
7247 while(
IsLCAtHV(13, (HLoc + RStep), VLoc))
7253 for(
int x = LStep; x < (RStep + 1); x++)
7272 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7275 throw Exception(
"Error, Wrong track type in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7277 if((BaseElementSpeedTag != 1) && (BaseElementSpeedTag != 2))
7279 throw Exception(
"Error, Wrong BaseElementSpeedTag value in PlotPlainRaisedLinkedLevelCrossingBarriersAndSetMarkers");
7284 if(BaseElementSpeedTag == 1)
7288 while(
IsLCAtHV(35, HLoc, (VLoc + UpStep)))
7295 while(
IsLCAtHV(36, HLoc, (VLoc + DownStep)))
7301 for(
int x = UpStep; x <= DownStep; x++)
7315 while(
IsLCAtHV(37, (HLoc + LStep), VLoc))
7322 while(
IsLCAtHV(38, (HLoc + RStep), VLoc))
7328 for(
int x = LStep; x <= RStep; x++)
7344 Graphics::TBitmap *RouteGraphic;
7347 if(BaseElementSpeedTag == 1)
7349 if(TypeOfRoute == 1)
7353 else if(TypeOfRoute == 0)
7359 RouteGraphic = BaseGraphic;
7363 RouteGraphic = BaseGraphic;
7369 if(TypeOfRoute == 1)
7373 else if(TypeOfRoute == 0)
7379 RouteGraphic = BaseGraphic;
7383 RouteGraphic = BaseGraphic;
7388 while(
IsLCAtHV(14, HLoc, (VLoc + UpStep)))
7393 Disp->
PlotOutput(175, HLoc * 16, (VLoc + UpStep) * 16, RouteGraphic);
7397 Disp->
PlotOutput(234, HLoc * 16, (VLoc + UpStep) * 16, BaseGraphic);
7404 while(
IsLCAtHV(15, HLoc, (VLoc + DownStep)))
7407 Disp->
PlotOutput(177, HLoc * 16, (VLoc + DownStep) * 16, BaseGraphic);
7412 while(
IsLCAtHV(16, (HLoc + LeftStep), VLoc))
7417 Disp->
PlotOutput(235, (HLoc + LeftStep) * 16, VLoc * 16, RouteGraphic);
7421 Disp->
PlotOutput(236, (HLoc + LeftStep) * 16, VLoc * 16, BaseGraphic);
7428 while(
IsLCAtHV(17, (HLoc + RightStep), VLoc))
7431 Disp->
PlotOutput(238, (HLoc + RightStep) * 16, VLoc * 16, BaseGraphic);
7556 throw Exception(
"Element not found in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7560 throw Exception(
"Element not a level crossing in LowerLCBarriersAtHV " + AnsiString(HLoc) +
"," + AnsiString(VLoc));
7591 "," + AnsiString(VLoc));
7595 int DummyRouteNumber;
7597 TrainPresent =
false;
7601 while(
IsLCAtHV(25, HLoc, (VLoc + UpStep)))
7603 TrackMapKeyPair.first = HLoc;
7604 TrackMapKeyPair.second = VLoc + UpStep;
7605 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7614 TrainPresent =
true;
7628 while(
IsLCAtHV(26, HLoc, (VLoc + DownStep)))
7630 TrackMapKeyPair.first = HLoc;
7631 TrackMapKeyPair.second = VLoc + DownStep;
7632 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7641 TrainPresent =
true;
7655 while(
IsLCAtHV(27, (HLoc + LeftStep), VLoc))
7657 TrackMapKeyPair.first = HLoc + LeftStep;
7658 TrackMapKeyPair.second = VLoc;
7659 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7668 TrainPresent =
true;
7682 while(
IsLCAtHV(28, (HLoc + RightStep), VLoc))
7684 TrackMapKeyPair.first = HLoc + RightStep;
7685 TrackMapKeyPair.second = VLoc;
7686 TrackMapPtr =
TrackMap.find(TrackMapKeyPair);
7695 TrainPresent =
true;
7715 for(
unsigned int x = 0; x < SearchVector.size(); x++)
7732 AnsiString(HLoc) +
"," + AnsiString(VLoc));
7735 throw Exception(
"PlotSmallFlashingLinkedLevelCrossings");
7741 while(
IsLCAtHV(61, HLoc, (VLoc + UpStep)))
7748 while(
IsLCAtHV(62, HLoc, (VLoc + DownStep)))
7754 for(
int x = UpStep; x <= DownStep; x++)
7761 while(
IsLCAtHV(63, (HLoc + LStep), VLoc))
7768 while(
IsLCAtHV(64, (HLoc + RStep), VLoc))
7774 for(
int x = LStep; x <= RStep; x++)
7790 throw Exception(
"Error, Wrong track type in GetFilletGraphic");
7797 else if(TrackElement.
SpeedTag < 132)
7815 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
7832 AnsiString(ScreenPosV));
7847 AnsiString(ScreenPosV));
7858 AnsiString(VPosTrue));
7872 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7884 throw Exception(
"CheckMapAndTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7885 " in TrackMap, Caller=" + (AnsiString)Caller);
7887 if(MapVecPos != (
int)a)
7889 throw Exception(
"CheckMapAndTrack Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7890 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)MapVecPos +
" TrackVectorPos value=" + (AnsiString)a +
" Caller=" +
7891 (AnsiString)Caller);
7897 throw Exception(
"CheckMapAndTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7898 " Caller=" + (AnsiString)Caller);
7918 throw Exception(
"CheckMapAndInactiveTrack Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
7919 " in InactiveMap, Caller=" + (AnsiString)Caller);
7921 if((InactivePair.first != a) && (InactivePair.second != a))
7923 throw Exception(
"CheckMapAndInactiveTrack Error - InactiveMapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
7924 (AnsiString)CheckElement.
VLoc +
" Inactive Map values=" + (AnsiString)InactivePair.first +
" and " + (AnsiString)InactivePair.second +
7925 " InactiveTrackVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
7930 throw Exception(
"CheckMapAndInactiveTrack Error - Map Size=" + (AnsiString)
TrackVector.size() +
" TrackVectorSize=" + (AnsiString)
TrackVector.size() +
7931 " Caller=" + (AnsiString)Caller);
7941 int Position1, Position2;
7947 for(GapMapPtr =
GapMap.begin(); GapMapPtr !=
GapMap.end(); GapMapPtr++)
7949 int HLoc1 = GapMapPtr->first.first;
7950 int VLoc1 = GapMapPtr->first.second;
7951 int HLoc2 = GapMapPtr->second.first;
7952 int VLoc2 = GapMapPtr->second.second;
7955 throw Exception(
"Failed to find H & V for gap1, GapMap in error");
7959 throw Exception(
"Failed to find H & V for gap2, GapMap in error");
7963 throw Exception(
"Element at Pos1 not a gap, GapMap in error");
7967 throw Exception(
"Element at Pos2 not a gap, GapMap in error");
7971 unsigned int GapCount = 0;
7973 for(
unsigned int a = 0; a <
TrackVector.size(); a++)
7981 if((
GapMap.size() * 2) != GapCount)
7983 throw Exception(
"GapMap Error - Map Size * 2 =" + (AnsiString)(
GapMap.size() * 2) +
" GapCount=" + (AnsiString)GapCount +
" Caller=" +
7984 (AnsiString)Caller);
7994 if((TrackElement.
HLoc == -2000000000) || (TrackElement.
VLoc == -2000000000))
7998 throw Exception(
"Error - TrackFinished with erase element still present");
8003 AnsiString IDString;
8005 if(TrackElement.
HLoc < 0)
8007 IDString =
"N" + AnsiString(abs(TrackElement.
HLoc)) +
"-";
8011 IDString = AnsiString(TrackElement.
HLoc) +
"-";
8013 if(TrackElement.
VLoc < 0)
8015 IDString +=
"N" + AnsiString(abs(TrackElement.
VLoc));
8019 IDString += AnsiString(TrackElement.
VLoc);
8034 for(
int x = 1; x < String.Length() + 1; x++)
8036 if(String.IsDelimiter(
"-", x))
8041 if(x == String.Length())
8045 ShowMessage(
"Error in track element identifier: <" + String +
"> - no delimiter");
8055 ShowMessage(
"Error in track element identifier: <" + String +
"> - No Horizontal value");
8060 if(DelimPos == String.Length())
8064 ShowMessage(
"Error in track element identifier <" + String +
"> - No Vertical value");
8069 if((String[String.Length()] <
'0') || (String[String.Length()] >
'9'))
8073 ShowMessage(
"Error in track element identifier <" + String +
"> - Last value is not a number");
8080 if(String.SubString(1, 1) !=
"N")
8082 for(
int x = 1; x < DelimPos; x++)
8084 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8088 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
8095 if(String.SubString(1, 1) ==
"N")
8097 for(
int x = 2; x < DelimPos; x++)
8099 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8103 ShowMessage(
"Invalid character in Horizontal value in track element identifier: <" + String +
">");
8110 if(String.SubString(1, 1) ==
"N")
8112 HLoc = -(String.SubString(2, DelimPos - 2).ToInt());
8116 HLoc = String.SubString(1, DelimPos - 1).ToInt();
8118 if(String.SubString(DelimPos + 1, 1) !=
"N")
8120 for(
int x = DelimPos + 1; x < String.Length() + 1; x++)
8122 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8126 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8133 if(String.SubString(DelimPos + 1, 1) ==
"N")
8135 for(
int x = DelimPos + 2; x < String.Length() + 1; x++)
8137 if((String.SubString(x, 1) <
"0") || (String.SubString(x, 1) >
"9"))
8141 ShowMessage(
"Invalid character in Vertical value in track element identifier: <" + String +
">");
8148 if(String.SubString(DelimPos + 1, 1) ==
"N")
8150 VLoc = -(String.SubString(DelimPos + 2, String.Length() - DelimPos - 1).ToInt());
8154 VLoc = String.SubString(DelimPos + 1, String.Length() - DelimPos).ToInt();
8159 TrackMapPtr =
TrackMap.find(HVPair);
8164 ShowMessage(
"No track element corresponding to track element identifier: <" + String +
">");
8170 return(TrackMapPtr->second);
8172 catch(
const Exception &e)
8175 ShowMessage(
"Syntax error in track element identifier: <" + String +
">");
8189 AnsiString(TrackElement.
VLoc) +
"," + AnsiString(TrackElement.
SpeedTag));
8190 int HLoc = TrackElement.
HLoc;
8191 int VLoc = TrackElement.
VLoc;
8294 AnsiString(SpeedTag));
8305 if(HVRange.first == HVRange.second)
8312 HVIt1 = HVRange.first;
8317 if(--HVRange.second != HVRange.first)
8319 HVIt2 = HVRange.second;
8323 HVIt2->second).
SpeedTag == SpeedTag)))
8343 AnsiString(SpeedTag));
8409 AnsiString TestString1, TestString2;
8414 throw Exception(
"LNPendingList size not 1 on entry");
8416 int CurrentElementNumber;
8417 bool FoundFlag =
false, ErasedFlag =
false;
8423 int H = CurrentElement->HLoc;
8424 int V = CurrentElement->VLoc;
8425 int Tag = CurrentElement->SpeedTag;
8431 for(
int x = 0; x < 25; x++)
8441 for(
int x = 0; x < 25; x++)
8451 for(
int x = 0; x < 25; x++)
8461 for(
int x = 0; x < 25; x++)
8471 for(
int x = 0; x < 28; x++)
8481 for(
int x = 0; x < 8; x++)
8491 for(
int x = 0; x < 8; x++)
8501 for(
int x = 0; x < 4; x++)
8517 bool FoundFlag2 =
false;
8535 for(
int x = 0; x < 8; x++)
8545 for(
int x = 0; x < 8; x++)
8558 if(CurrentElementNumber > -1)
8563 if((ExistingName !=
"") && (ExistingName != LocationName))
8579 AddName(1, CurrentElement, LocationName);
8583 LNDone2MultiMapEntry.first = HVPair;
8595 if(SNRange.first != SNRange.second)
8599 for(SNIterator = SNRange.second; SNIterator != SNRange.first; SNIterator--)
8606 TVIt->LocationName =
"";
8607 TVIt->ActiveTrackElementName =
"";
8641 std::pair<AnsiString, char>TempMapPair;
8649 TempMapPair.second =
'x';
8667 AnsiString(SpeedTag));
8677 if((SpeedTag == 129) || (SpeedTag == 130) || (SpeedTag == 145) || (SpeedTag == 146))
8684 int MapPos = -1 - Position;
8688 FoundElement = MapPos;
8704 FoundElement = IMPair.first;
8713 FoundElement = IMPair.second;
8734 AnsiString OldName = TrackElement->LocationName, ErrorString;
8736 TrackElement->LocationName = Name;
8737 int HLoc = TrackElement->HLoc;
8738 int VLoc = TrackElement->VLoc;
8752 if(ErrorString !=
"")
8754 throw Exception(ErrorString +
" in AddName for OldName == " + OldName);
8778 if(LNDone2MultiMapIterator->second == MapPos)
8805 if(*LNPendingListIterator == MapPos)
8878 if(NameBeingChecked !=
"")
8884 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8892 NameBeingChecked = LNMMRg.second->first;
8894 if(NameBeingChecked !=
"")
8900 ShowMessage(
"Please note that more than one instance of " + NameBeingChecked +
" was found. Location names must be unique before the railway can be saved as a .rly file");
8921 if(LNMMIt->second < 0)
8931 HVPairsLinkedMap.insert(std::pair<THVPair, bool>(HVPair,
false));
8939 std::list<THVPair> HVLinkedList;
8942 HVPairsLinkedMap.begin()->second =
true;
8943 HVLinkedList.push_back(HVPairsLinkedMap.begin()->first);
8946 THVPair HVPairUnderExamination;
8947 THVPairsLinkedMap::iterator HVPLMIt;
8949 while(!HVLinkedList.empty())
8951 HVPairUnderExamination = HVLinkedList.front();
8952 HVLinkedList.pop_front();
8953 HVPairNew.first = HVPairUnderExamination.first;
8954 HVPairNew.second = HVPairUnderExamination.second - 1;
8955 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8956 if(HVPLMIt != HVPairsLinkedMap.end())
8958 if(!HVPLMIt->second)
8960 HVLinkedList.push_back(HVPLMIt->first);
8962 HVPLMIt->second =
true;
8964 HVPairNew.first = HVPairUnderExamination.first - 1;
8965 HVPairNew.second = HVPairUnderExamination.second;
8966 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8967 if(HVPLMIt != HVPairsLinkedMap.end())
8969 if(!HVPLMIt->second)
8971 HVLinkedList.push_back(HVPLMIt->first);
8973 HVPLMIt->second =
true;
8975 HVPairNew.first = HVPairUnderExamination.first;
8976 HVPairNew.second = HVPairUnderExamination.second + 1;
8977 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8978 if(HVPLMIt != HVPairsLinkedMap.end())
8980 if(!HVPLMIt->second)
8982 HVLinkedList.push_back(HVPLMIt->first);
8984 HVPLMIt->second =
true;
8986 HVPairNew.first = HVPairUnderExamination.first + 1;
8987 HVPairNew.second = HVPairUnderExamination.second;
8988 HVPLMIt = HVPairsLinkedMap.find(HVPairNew);
8989 if(HVPLMIt != HVPairsLinkedMap.end())
8991 if(!HVPLMIt->second)
8993 HVLinkedList.push_back(HVPLMIt->first);
8995 HVPLMIt->second =
true;
9000 for(THVPairsLinkedMap::iterator HVPLMIt = HVPairsLinkedMap.begin(); HVPLMIt != HVPairsLinkedMap.end(); HVPLMIt++)
9002 if(!HVPLMIt->second)
9021 if(LocationName ==
"")
9032 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9039 ActiveTrackElementNameMapEntry.second = 0;
9061 bool FoundFlag, ErasedFlag =
false;
9065 if(SNRange.first != SNRange.second)
9068 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9071 TVIt->LocationName =
"";
9072 TVIt->ActiveTrackElementName =
"";
9106 AnsiString(VLoc) +
"," + AnsiString(SpeedTag));
9108 AnsiString LocationName;
9117 if(LocationName !=
"")
9125 if(LocationName !=
"")
9139 if(LocationName !=
"")
9141 int ModifiedPosition = -1 - Position;
9150 for(
int x = 0; x < 25; x++)
9160 else if(SpeedTag == 77)
9162 for(
int x = 0; x < 25; x++)
9172 else if(SpeedTag == 78)
9174 for(
int x = 0; x < 25; x++)
9184 else if(SpeedTag == 79)
9186 for(
int x = 0; x < 25; x++)
9196 else if(SpeedTag == 96)
9198 for(
int x = 0; x < 28; x++)
9208 else if(SpeedTag == 129)
9210 for(
int x = 0; x < 8; x++)
9220 else if(SpeedTag == 130)
9222 for(
int x = 0; x < 8; x++)
9232 else if(SpeedTag == 145)
9234 for(
int x = 0; x < 8; x++)
9244 else if(SpeedTag == 146)
9246 for(
int x = 0; x < 8; x++)
9256 else if(SpeedTag == 131)
9258 for(
int x = 0; x < 4; x++)
9278 bool FoundFlag2 =
false;
9305 AnsiString(SpeedTag));
9317 if(TempElement->LocationName !=
"")
9319 LocationName = TempElement->LocationName;
9320 FoundElement = IMPair.first;
9328 if(TempElement->LocationName !=
"")
9330 LocationName = TempElement->LocationName;
9331 FoundElement = IMPair.second;
9343 if(TempElement->LocationName !=
"")
9345 LocationName = TempElement->LocationName;
9346 FoundElement = -1 - Position;
9362 unsigned int Count = 0;
9369 AnsiString SName, TName, ErrorString;
9371 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9377 throw Exception(
"Track element has FixedNamedLocationElement set but is not a footbridge/underpass in CheckLocationNameMultiMap, caller = " +
9378 AnsiString(Caller));
9391 (
"Inactive track element has FixedNamedLocationElement set but is not a platform, concourse or named location in CheckLocationNameMultiMap, caller = " +
9392 AnsiString(Caller));
9399 throw Exception(
"LocationNameMultiMap size = " + AnsiString(
LocationNameMultiMap.size()) +
" & Count = " + AnsiString(Count) +
9400 " in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9405 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9411 if(ErrorString !=
"")
9413 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for TrackVector check, caller = " + AnsiString(Caller));
9415 if(SNIt->second != -1 - (
int)x)
9417 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9418 AnsiString(Caller));
9424 bool FoundFlag =
false;
9433 throw Exception(
"Track element with ActiveTrackElementName but no plat/named loc at H " + AnsiString(
TrackElementAt(1369, x).HLoc) +
" & V " +
9434 AnsiString(
TrackElementAt(1370, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9438 throw Exception(
"Track element with ActiveTrackElementName " + TName +
" but plat/named loc at H " + AnsiString(
TrackElementAt(1371, x).HLoc) +
9439 " & V " + AnsiString(
TrackElementAt(1372, x).VLoc) +
" has different LocationName in CheckLocationNameMultiMap, caller = " +
9440 AnsiString(Caller));
9445 throw Exception(
"Track element with ActiveTrackElementName but no inactive element at H " + AnsiString(
TrackElementAt(1373, x).HLoc) +
" & V " +
9446 AnsiString(
TrackElementAt(1374, x).VLoc) +
" in CheckLocationNameMultiMap, caller = " + AnsiString(Caller));
9456 if(ErrorString !=
"")
9458 throw Exception(ErrorString +
" in CheckLocationNameMultiMap for InactiveTrackVector check, caller = " + AnsiString(Caller));
9460 if(SNIt->second != (
int)x)
9462 throw Exception(
"Elements different in name map & TrackVector in CheckLocationNameMultiMap for TrackVector check, caller = " +
9463 AnsiString(Caller));
9473 AnsiString &ErrorString)
9481 AnsiString(TrackElement->HLoc) +
"," + AnsiString(TrackElement->VLoc) +
"," + AnsiString(TrackElement->SpeedTag));
9483 bool FoundFlag =
false;
9487 if(SNRange.first == SNRange.second)
9489 ErrorString =
"Error, Name " + LocationName +
" not found in map";
9491 return(SNRange.first);
9495 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
9497 if(SNIterator->second < 0)
9499 int TVPos = -1 - SNIterator->second;
9501 if(TVIt == TrackElement)
9510 int ITVPos = SNIterator->second;
9512 if(ITVIt == TrackElement)
9523 ErrorString =
"Error, Name " + LocationName +
" found but not at required element";
9540 LocationNameEntry.first = NewName;
9541 LocationNameEntry.second = SNIterator->second;
9555 int TruePos = -1 - Position;
9559 throw Exception(
"Footbridge/underpass error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9569 throw Exception(
"Inactive element error in GetTrackVectorIteratorFromNamePosition, caller = " + AnsiString(Caller));
9592 InactiveTrack2MultiMapIterator++)
9594 if(InactiveTrack2MultiMapIterator->second > VecPos)
9596 InactiveTrack2MultiMapIterator->second--;
9604 LocationNameMultiMapIterator++)
9606 if(LocationNameMultiMapIterator->second < 0)
9610 if(LocationNameMultiMapIterator->second > (
int)VecPos)
9612 LocationNameMultiMapIterator->second--;
9634 for(TrackMapIterator =
TrackMap.begin(); TrackMapIterator !=
TrackMap.end(); TrackMapIterator++)
9636 if(TrackMapIterator->second > VecPos)
9638 TrackMapIterator->second--;
9646 LocationNameMultiMapIterator++)
9648 if(LocationNameMultiMapIterator->second >= 0)
9654 if(LocationNameMultiMapIterator->second < -(
int)(VecPos + 1))
9656 LocationNameMultiMapIterator->second++;
9660 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9666 if(TkEl.
Conn[0] ==
int(VecPos))
9671 if(TkEl.
Conn[0] >
int(VecPos))
9675 if(TkEl.
Conn[0] > -1)
9703 for(
unsigned int TVPos = 0; TVPos <
TrackVector.size(); TVPos++)
9709 LocationNameEntry.second = -1 - TVPos;
9720 LocationNameEntry.second = ITVPos;
9762 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9794 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
9822 AnsiString((
short)FirstTrack));
9823 bool LengthDifferent =
false, SpeedDifferent =
false;
9830 int EXArray[16][2] =
9832 {2, 4}, {6, 2}, {8, 6}, {4, 8},
9833 {1, 6}, {3, 8}, {9, 4}, {7, 2}, {1, 8}, {3, 4}, {9, 2}, {7, 6},
9836 int Index = -1, BrNum = -1, GrNum = -1, InLink, OutLink;
9837 Graphics::TBitmap *Bitmap;
9841 InLink = TrackElement.
Link[0];
9842 OutLink = TrackElement.
Link[1];
9846 InLink = TrackElement.
Link[2];
9847 OutLink = TrackElement.
Link[3];
9849 for(
int x = 0; x < 16; x++)
9851 if((InLink == EXArray[x][0] && OutLink == EXArray[x][1]) || (InLink == EXArray[x][1] && OutLink == EXArray[x][0]))
9858 throw Exception(
"Error, failed to find Index in TTrack::MarkOneLength");
9877 else if(TrackElement.
SpeedTag == 54)
9881 else if(TrackElement.
SpeedTag == 55)
9892 else if(TrackElement.
SpeedTag == 58)
9896 else if(TrackElement.
SpeedTag == 59)
9901 else if(Index == 14)
9907 else if(TrackElement.
SpeedTag == 52)
9911 else if(TrackElement.
SpeedTag == 57)
9916 else if(Index == 15)
9922 else if(TrackElement.
SpeedTag == 53)
9926 else if(TrackElement.
SpeedTag == 56)
9940 if(LengthDifferent && SpeedDifferent)
10008 else if(LengthDifferent && !SpeedDifferent)
10155 AnsiString((
short)FirstTrack));
10156 LengthDifferent =
false;
10157 SpeedDifferent =
false;
10162 LengthDifferent =
true;
10166 SpeedDifferent =
true;
10168 if(LengthDifferent || SpeedDifferent)
10181 LengthDifferent =
true;
10185 SpeedDifferent =
true;
10187 if(LengthDifferent || SpeedDifferent)
10200 LengthDifferent =
true;
10204 SpeedDifferent =
true;
10206 if(LengthDifferent || SpeedDifferent)
10286 AnsiString TempName;
10287 int VecPos, StartVecPos, Count, EntryPos, StartEntryPos, ForwardNumber, ReverseNumber;
10288 bool ForwardSet, ReverseSet;
10290 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10295 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10300 ForwardSet =
false;
10301 ReverseSet =
false;
10335 for(
int y = 0; y < 2; y++)
10366 StartElement = TempElement;
10367 StartVecPos = VecPos;
10370 EntryPos = 1 - Dir;
10371 StartEntryPos = 1 - Dir;
10379 VecPos = TempElement.
Conn[1 - EntryPos];
10380 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10382 EntryPos = TempEntryPos;
10403 ForwardNumber = ((Count + 1) / 2) + 1;
10404 ReverseNumber = (Count - ForwardNumber) + 1;
10406 EntryPos = 1 - Dir;
10407 TempElement = StartElement;
10408 VecPos = StartVecPos;
10409 if(Count == ForwardNumber)
10414 if(Count == ReverseNumber)
10422 VecPos = TempElement.
Conn[1 - EntryPos];
10423 int TempEntryPos = TempElement.
ConnLinkPos[1 - EntryPos];
10425 EntryPos = TempEntryPos;
10427 if(Count == ForwardNumber)
10432 if(Count == ReverseNumber)
10445 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10474 AnsiString TempName;
10475 std::list<unsigned int> NameList;
10476 std::list<AnsiString> ContinuationNameList;
10477 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10483 ContinuationNameList.push_back(
TrackElementAt(1597, x).ActiveTrackElementName);
10486 ContinuationNameList.sort();
10487 ContinuationNameList.unique();
10489 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10494 bool NameIsAContinuation =
false;
10495 if(std::find(ContinuationNameList.begin(), ContinuationNameList.end(), TempElement.
ActiveTrackElementName) != ContinuationNameList.end())
10497 NameIsAContinuation =
true;
10510 if(((TempElement.
Conn[2] > -1)) && (TempElement.
Conn[3] > -1) &&
10518 NameList.push_back(x);
10523 if((TempElement.
Conn[2] > -1) && (TempElement.
Conn[3] > -1) &&
10531 NameList.push_back(x);
10541 NameList.push_back(x);
10544 while(!NameList.empty())
10546 unsigned int a = NameList.front();
10547 NameList.pop_front();
10705 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
10761 if((TextH / 16) - 1 <
HLocMin)
10765 if((TextH / 16) + 1 >
HLocMax)
10769 if((TextV / 16) - 1 <
VLocMin)
10773 if((TextV / 16) + 1 >
VLocMax)
10803 void TTrack::UserGraphicMove(
int Caller,
int HPosInput,
int VPosInput,
int &UserGraphicItem,
int &UserGraphicMoveHPos,
int &UserGraphicMoveVPos,
10804 bool &UserGraphicFoundFlag)
10807 TUserGraphicVector::iterator UserGraphicPtr;
10809 UserGraphicFoundFlag =
false;
10816 if((HPosInput >= (*UserGraphicPtr).HPos) && (HPosInput < ((*UserGraphicPtr).HPos + (*UserGraphicPtr).Width)) && (VPosInput >=
10817 (*UserGraphicPtr).VPos) && (VPosInput < ((*UserGraphicPtr).VPos + (*UserGraphicPtr).Height)))
10819 UserGraphicItem = x;
10820 UserGraphicMoveHPos = (*UserGraphicPtr).HPos;
10821 UserGraphicMoveVPos = (*UserGraphicPtr).VPos;
10822 UserGraphicFoundFlag =
true;
10840 int SpeedTag = TrackElement.
SpeedTag;
10844 throw Exception(
"Error - SpeedTag value " + AnsiString(SpeedTag) +
" in RetrieveStripedNamedLocationGraphicsWhereRelevant");
10893 return(GraphicOutput);
10901 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10904 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in TrackElementAt");
10917 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
InactiveTrackVector.size()) +
", At: " + AnsiString(At) +
10918 " in InactiveTrackElementAt");
10929 if((At < 0) || ((
unsigned int)At >=
TrackVector.size()))
10931 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in BlankElementAt");
10956 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
10957 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
10961 if(SNRange.first == SNRange.second)
10966 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
10968 if(SNIterator->second < 0)
10982 HVPair.first = InactiveElement.
HLoc;
10983 HVPair.second = InactiveElement.
VLoc;
10987 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneStationLongEnoughForSplit (1)");
10989 int TVPos =
TrackMap.find(HVPair)->second;
10992 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
10998 FirstNamedExitPos = 0;
11000 SecondNamedElement =
TrackElementAt(561, FirstNamedElement.
Conn[FirstNamedExitPos]);
11002 FirstNamedLinkedElement =
TrackElementAt(562, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11003 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
11006 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11008 SecondNamedLinkedElement =
TrackElementAt(563, SecondNamedElement.
Conn[SecondNamedExitPos]);
11009 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
11010 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
11013 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
11023 FirstNamedExitPos = 1;
11025 SecondNamedElement =
TrackElementAt(564, FirstNamedElement.
Conn[FirstNamedExitPos]);
11027 FirstNamedLinkedElement =
TrackElementAt(565, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11028 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
11031 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11033 SecondNamedLinkedElement =
TrackElementAt(566, SecondNamedElement.
Conn[SecondNamedExitPos]);
11034 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
11035 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
11038 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
11064 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
11065 int FirstNamedExitPos, SecondNamedEntryPos, SecondNamedExitPos;
11069 if(SNRange.first == SNRange.second)
11074 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11076 if(SNIterator->second < 0)
11090 HVPair.first = InactiveElement.
HLoc;
11091 HVPair.second = InactiveElement.
VLoc;
11094 throw Exception (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in OneNonStationLongEnoughForSplit(1)");
11096 int TVPos =
TrackMap.find(HVPair)->second;
11099 if(((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1)) && ((FirstNamedElement.
Conn[2] == -1) || (FirstNamedElement.
Conn[3] == -1)))
11104 if((FirstNamedElement.
Conn[2] == -1) || (FirstNamedElement.
Conn[3] == -1))
11106 FirstNamedExitPos = 0;
11108 SecondNamedElement =
TrackElementAt(1611, FirstNamedElement.
Conn[FirstNamedExitPos]);
11111 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11112 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11114 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11116 else if(SecondNamedEntryPos == 2)
11118 SecondNamedExitPos = 3;
11120 else if(SecondNamedEntryPos == 3)
11122 SecondNamedExitPos = 2;
11124 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11131 FirstNamedExitPos = 1;
11133 SecondNamedElement =
TrackElementAt(1612, FirstNamedElement.
Conn[FirstNamedExitPos]);
11136 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11137 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11139 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11141 else if(SecondNamedEntryPos == 2)
11143 SecondNamedExitPos = 3;
11145 else if(SecondNamedEntryPos == 3)
11147 SecondNamedExitPos = 2;
11149 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11157 else if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
11159 FirstNamedExitPos = 2;
11161 SecondNamedElement =
TrackElementAt(1613, FirstNamedElement.
Conn[FirstNamedExitPos]);
11164 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11165 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11167 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11169 else if(SecondNamedEntryPos == 2)
11171 SecondNamedExitPos = 3;
11173 else if(SecondNamedEntryPos == 3)
11175 SecondNamedExitPos = 2;
11177 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11184 FirstNamedExitPos = 3;
11186 SecondNamedElement =
TrackElementAt(1614, FirstNamedElement.
Conn[FirstNamedExitPos]);
11189 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11190 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11192 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11194 else if(SecondNamedEntryPos == 2)
11196 SecondNamedExitPos = 3;
11198 else if(SecondNamedEntryPos == 3)
11200 SecondNamedExitPos = 2;
11202 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11218 int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
11232 AnsiString(FirstNamedElementPos));
11233 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
11234 int FirstNamedExitPos, SecondNamedExitPos, FirstNamedLinkedExitPos, SecondNamedLinkedEntryPos;
11236 SecondNamedElementPos = -1;
11237 FirstNamedLinkedElementPos = -1;
11238 SecondNamedLinkedElementPos = -1;
11242 if(SNRange.first == SNRange.second)
11247 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11249 if(SNIterator->second < 0)
11259 HVPair.first = InactiveElement.
HLoc;
11260 HVPair.second = InactiveElement.
VLoc;
11272 (
"Error - failed to find element in TrackMap for a non-concourse element in LocationNameMultiMap in ThisStationLongEnoughForSplit (2)");
11275 int TVPos =
TrackMap.find(HVPair)->second;
11276 if(TVPos != FirstNamedElementPos)
11282 if((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1))
11288 FirstNamedExitPos = 0;
11289 SecondNamedElement =
TrackElementAt(568, FirstNamedElement.
Conn[FirstNamedExitPos]);
11291 FirstNamedLinkedElement =
TrackElementAt(569, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11292 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
11295 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11297 SecondNamedLinkedElement =
TrackElementAt(570, SecondNamedElement.
Conn[SecondNamedExitPos]);
11298 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
11299 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
11302 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
11304 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
11305 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
11306 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
11314 FirstNamedExitPos = 1;
11315 SecondNamedElement =
TrackElementAt(571, FirstNamedElement.
Conn[FirstNamedExitPos]);
11317 FirstNamedLinkedElement =
TrackElementAt(572, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11318 FirstNamedLinkedExitPos = FirstNamedElement.
ConnLinkPos[1 - FirstNamedExitPos];
11321 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11323 SecondNamedLinkedElement =
TrackElementAt(573, SecondNamedElement.
Conn[SecondNamedExitPos]);
11324 SecondNamedLinkedEntryPos = SecondNamedElement.
ConnLinkPos[SecondNamedExitPos];
11325 if((SecondNamedLinkedElement.
TrackType !=
Points) || (SecondNamedLinkedEntryPos != 3))
11328 if((FirstNamedLinkedElement.
TrackType !=
Points) || (FirstNamedLinkedExitPos != 3))
11330 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
11331 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
11332 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
11346 bool TTrack::ThisNonStationLongEnoughForSplit(
int Caller, AnsiString LocationName,
int FirstNamedElementPos,
int TrainLinkPos,
int &SecondNamedElementPos,
int &FirstNamedLinkedElementPos,
int &SecondNamedLinkedElementPos)
11360 AnsiString(FirstNamedElementPos) +
"," + AnsiString(TrainLinkPos));
11361 TTrackElement InactiveElement, FirstNamedElement, SecondNamedElement, FirstNamedLinkedElement, SecondNamedLinkedElement;
11362 int FirstNamedExitPos, SecondNamedEntryPos, SecondNamedExitPos;
11364 SecondNamedElementPos = -1;
11365 FirstNamedLinkedElementPos = -1;
11366 SecondNamedLinkedElementPos = -1;
11370 if(SNRange.first == SNRange.second)
11375 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11377 if(SNIterator->second < 0)
11387 HVPair.first = InactiveElement.
HLoc;
11388 HVPair.second = InactiveElement.
VLoc;
11393 int TVPos =
TrackMap.find(HVPair)->second;
11394 if(TVPos != FirstNamedElementPos)
11400 if(((FirstNamedElement.
Conn[0] == -1) || (FirstNamedElement.
Conn[1] == -1)) && ((FirstNamedElement.
Conn[2] == -1) || (FirstNamedElement.
Conn[3] == -1)))
11405 bool LowLinks =
true;
11406 if(TrainLinkPos > 1)
11410 if((LowLinks && FirstNamedElement.
Conn[0] > -1) && (FirstNamedElement.
Conn[1] > -1))
11412 FirstNamedExitPos = 0;
11413 SecondNamedElement =
TrackElementAt(1616, FirstNamedElement.
Conn[FirstNamedExitPos]);
11414 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11415 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11417 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11419 else if(SecondNamedEntryPos == 2)
11421 SecondNamedExitPos = 3;
11423 else if(SecondNamedEntryPos == 3)
11425 SecondNamedExitPos = 2;
11427 FirstNamedLinkedElement =
TrackElementAt(1617, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11430 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11432 SecondNamedLinkedElement =
TrackElementAt(1618, SecondNamedElement.
Conn[SecondNamedExitPos]);
11433 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
11434 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
11435 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
11441 FirstNamedExitPos = 1;
11442 SecondNamedElement =
TrackElementAt(1619, FirstNamedElement.
Conn[FirstNamedExitPos]);
11443 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11444 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11446 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11448 else if(SecondNamedEntryPos == 2)
11450 SecondNamedExitPos = 3;
11452 else if(SecondNamedEntryPos == 3)
11454 SecondNamedExitPos = 2;
11456 FirstNamedLinkedElement =
TrackElementAt(1620, FirstNamedElement.
Conn[1 - FirstNamedExitPos]);
11459 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11461 SecondNamedLinkedElement =
TrackElementAt(1621, SecondNamedElement.
Conn[SecondNamedExitPos]);
11462 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
11463 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[1 - FirstNamedExitPos];
11464 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
11470 else if((!LowLinks && FirstNamedElement.
Conn[2] > -1) && (FirstNamedElement.
Conn[3] > -1))
11472 FirstNamedExitPos = 2;
11473 SecondNamedElement =
TrackElementAt(1622, FirstNamedElement.
Conn[FirstNamedExitPos]);
11474 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11475 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11477 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11479 else if(SecondNamedEntryPos == 2)
11481 SecondNamedExitPos = 3;
11483 else if(SecondNamedEntryPos == 3)
11485 SecondNamedExitPos = 2;
11490 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11492 SecondNamedLinkedElement =
TrackElementAt(1624, SecondNamedElement.
Conn[SecondNamedExitPos]);
11493 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
11494 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[3];
11495 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
11501 FirstNamedExitPos = 3;
11502 SecondNamedElement =
TrackElementAt(1625, FirstNamedElement.
Conn[FirstNamedExitPos]);
11503 SecondNamedEntryPos = FirstNamedElement.
ConnLinkPos[FirstNamedExitPos];
11504 if((SecondNamedEntryPos == 0) || (SecondNamedEntryPos == 1))
11506 SecondNamedExitPos = 1 - SecondNamedEntryPos;
11508 else if(SecondNamedEntryPos == 2)
11510 SecondNamedExitPos = 3;
11512 else if(SecondNamedEntryPos == 3)
11514 SecondNamedExitPos = 2;
11519 if(SecondNamedElement.
Conn[SecondNamedExitPos] > -1)
11521 SecondNamedLinkedElement =
TrackElementAt(1627, SecondNamedElement.
Conn[SecondNamedExitPos]);
11522 SecondNamedElementPos = FirstNamedElement.
Conn[FirstNamedExitPos];
11523 FirstNamedLinkedElementPos = FirstNamedElement.
Conn[2];
11524 SecondNamedLinkedElementPos = SecondNamedElement.
Conn[SecondNamedExitPos];
11543 if(SNRange.first != SNRange.second)
11545 for(SNIterator = SNRange.first; SNIterator != SNRange.second; SNIterator++)
11547 if(SNIterator->second < 0)
11569 "," + AnsiString(SpeedTag));
11580 throw Exception(
"Error, FoundFlag false in PlatformOnSignalSide after IsPlatformOrNamedNonStationLocationPresent called successfully");
11610 else if(SpeedTag == 69)
11636 else if(SpeedTag == 70)
11662 else if(SpeedTag == 71)
11699 AnsiString(NextEntryPos) +
"," + AnsiString(OwnTrainID));
11700 if(NextEntryPos < 0)
11713 if(NextEntryPos > 1)
11732 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
TrackVector.size()) +
", At: " + AnsiString(At) +
" in SelectVectorAt");
11744 AnsiString(VLocIn) +
"," + AnsiString(LinkIn));
11745 bool FoundFlag =
false;
11760 int VLocHi = -2000000000, VLocLo = 2000000000, HLoc = 2000000000;
11761 bool FoundFlag =
false;
11786 VPosHi = 16 * VLocHi;
11787 VPosLo = 16 * VLocLo;
11806 AnsiString(EndTVPosition));
11817 int Link0Squares = ((EndElement.
HLoc - NewHLocLink0) * (EndElement.
HLoc - NewHLocLink0)) +
11818 ((EndElement.
VLoc - NewVLocLink0) * (EndElement.
VLoc - NewVLocLink0));
11819 int Link1Squares = ((EndElement.
HLoc - NewHLocLink1) * (EndElement.
HLoc - NewHLocLink1)) +
11820 ((EndElement.
VLoc - NewVLocLink1) * (EndElement.
VLoc - NewVLocLink1));
11822 if(Link0Squares <= Link1Squares)
11840 AnsiString(LinkPos));
11859 if((LinkPos == 1) && (TE.
Attribute == 0))
11864 else if(LinkPos == 1)
11870 else if((LinkPos == 3) && (TE.
Attribute == 1))
11875 else if(LinkPos == 3)
11882 else if(LinkPos == 0)
11887 else if(LinkPos == 1)
11892 else if(LinkPos == 2)
11897 else if(LinkPos == 3)
11902 throw Exception(
"Error, failure in GetExitPos");
11951 if((TE.
Link[0] == Link) || (TE.
Link[1] == Link))
11955 else if((TE.
Link[2] == Link) || (TE.
Link[3] == Link))
11997 "," + AnsiString(DiagonalLinkNumber));
12002 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(8, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
TrainOnLink(9, HLoc - 1, VLoc, 9, TrainID)))
12007 if(((DiagonalLinkNumber == 1) &&
TrainOnLink(10, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
TrainOnLink(11, HLoc, VLoc - 1, 9, TrainID)))
12012 if(((DiagonalLinkNumber == 3) &&
TrainOnLink(12, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(13, HLoc + 1, VLoc, 7, TrainID)))
12017 if(((DiagonalLinkNumber == 7) &&
TrainOnLink(14, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
TrainOnLink(15, HLoc, VLoc + 1, 3, TrainID)))
12033 AnsiString JustFileName =
"";
12038 int LastDelim = UGI.
FileName.LastDelimiter(
'\\');
12045 JustFileName = UGI.
FileName.SubString(LastDelim + 1, UGI.
FileName.Length() - LastDelim);
12064 typedef std::list<int> TNamePosList;
12065 TNamePosList NamePosList;
12066 typedef TNamePosList::iterator TNPLIt;
12068 typedef std::list<int> TOnePlatList;
12069 TOnePlatList OnePlatList;
12070 typedef TOnePlatList::iterator TOPLIt;
12073 NamePosList.clear();
12074 OnePlatList.clear();
12075 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
12077 if(
TrackElementAt(988, x).ActiveTrackElementName == LocationName)
12079 NamePosList.push_back(x);
12084 if(!NamePosList.empty())
12086 OnePlatList.push_back(NamePosList.back());
12087 NamePosList.pop_back();
12089 while(!OnePlatList.empty())
12091 TempInt = OnePlatList.front();
12094 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[0]);
12095 if(NPLIt != NamePosList.end() && ((TempElement.
Link[0] == 2) || (TempElement.
Link[0] == 4) || (TempElement.
Link[0] == 6) || (TempElement.
Link[0] == 8)))
12097 OnePlatList.push_back(TempElement.
Conn[0]);
12098 NamePosList.erase(NPLIt);
12100 NPLIt = find(NamePosList.begin(), NamePosList.end(), TempElement.
Conn[1]);
12101 if(NPLIt != NamePosList.end() && ((TempElement.
Link[1] == 2) || (TempElement.
Link[1] == 4) || (TempElement.
Link[1] == 6) || (TempElement.
Link[1] == 8)))
12103 OnePlatList.push_back(TempElement.
Conn[1]);
12104 NamePosList.erase(NPLIt);
12107 OnePlatList.erase(OnePlatList.begin());
12108 if(OnePlatList.empty())
12111 if(!NamePosList.empty())
12113 OnePlatList.push_back(NamePosList.back());
12114 NamePosList.pop_back();
12130 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not signal in RepairFailedSignals");
12134 throw Exception(
"Signals not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedSignals");
12162 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not points in RepairFailedPoints");
12166 throw Exception(
"Points not failed at " + AnsiString(FPVIt->TVPos) +
" in RepairFailedPoints");
12192 throw Exception(
"Element at " + AnsiString(FPVIt->TVPos) +
" not simple in RepairFailedPoints");
12196 throw Exception(
"No TSR at " + AnsiString(FPVIt->TVPos) +
" in RepairTSR");
12218 for(
unsigned int x = 0; x <
TrackVector.size(); x++)
12237 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
UserGraphicVector.size()) +
", At: " + AnsiString(At) +
" in UserGraphicVectorAt");
12252 throw Exception(
"Return value negative in call to LastElementNumber");
12264 throw Exception(
"PrefDirVector empty in call to LastElementPtr");
12278 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedPrefDirElementAt");
12290 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
PrefDirVector.size()) +
", At: " + AnsiString(At) +
12291 " in GetModifiablePrefDirElementAt");
12301 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
12303 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedSearchElementAt");
12313 if((At < 0) || ((
unsigned int)At >=
SearchVector.size()))
12315 throw Exception(
"Out of Range Error, vector size: " + AnsiString(
SearchVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableSearchElementAt");
12332 int TrackVectorPosition;
12383 FinishElement =
false;
12384 int TrackVectorPosition;
12406 if(TrackElement.
HLoc >= StartPrefDirElement.
HLoc)
12416 if(TrackElement.
VLoc >= StartPrefDirElement.
VLoc)
12439 for(
int x = 0; x < 4; x++)
12462 FinishElement =
true;
12470 for(
int x = 0; x < 4; x++)
12482 FinishElement =
true;
12490 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12497 .ELinkPos] ==
Lead))
12513 FinishElement =
true;
12532 FinishElement =
true;
12551 FinishElement =
true;
12566 FinishElement =
true;
12575 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12591 FinishElement =
true;
12597 "Unable to find a route to the selected element - may be unreachable, too far ahead, or invalid. Try selecting an end point closer to the start point.");
12620 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition));
12621 int VectorCount = 0;
12625 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
12627 for(
int x = 0; x < VectorCount; x++)
12634 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
12638 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
12639 SearchElement.
ELinkPos = NextELinkPos;
12660 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
12662 SearchElement.
XLinkPos = NextXLinkPos;
12688 for(
int x = 0; x < VectorCount; x++)
12700 for(
int x = 0; x < VectorCount; x++)
12714 for(
int x = 0; x < VectorCount; x++)
12728 for(
int x = 0; x < VectorCount; x++)
12738 for(
int x = 0; x < VectorCount; x++)
12749 SearchElement.
XLink = SearchElement.
Link[1];
12768 SearchElement.
XLink = SearchElement.
Link[3];
12781 for(
int x = 0; x < VectorCount; x++)
12796 XLinkPos = NextXLinkPos;
12797 CurrentTrackElement = SearchElement;
12816 throw Exception(
"Error, SearchVector empty");
12823 for(
int x = 0; x < 4; x++)
12876 throw Exception(
"Error in EntryExitNumber 1");
12895 if(PrefDirElement.
XLink == -1)
12907 if(PrefDirElement.
XLink != -1)
12911 throw Exception(
"Error in EntryExitNumber 2");
12949 LeadingPoints =
false;
12977 LeadingPoints =
true;
12993 AnsiString ErrorString;
12994 bool Error =
false;
13001 ErrorString =
"HLoc";
13007 ErrorString =
"VLoc";
13013 ErrorString =
"ELink";
13019 ErrorString =
"ELinkPos";
13025 ErrorString =
"XLink";
13031 ErrorString =
"XLinkPos";
13037 ErrorString =
"Tag";
13043 ErrorString =
"TrackVectorPosition";
13049 ErrorString =
"EXNumber";
13056 ErrorString =
"CheckCount";
13063 ErrorString =
"EntryGraphicPtr";
13069 ErrorString =
"EntryDirectionGraphicPtr";
13078 ErrorString =
"Last XLink not connected to this element";
13085 throw Exception(
"Error at " + AnsiString(Position) +
" " + ErrorString);
13109 for(
int PrefDirVecPos = (
PrefDirVector.size() - 1); PrefDirVecPos >= (int)x; PrefDirVecPos--)
13166 AnsiString((
short)BuildingPrefDir));
13169 if(PrefDirSize() == 0)
13174 for(
unsigned int x = 0; x < PrefDirSize(); x++)
13186 Disp->PlotOutput(12, (TempPrefDirElement.
HLoc * 16), (TempPrefDirElement.
VLoc * 16), TempPrefDirElement.
EXGraphicPtr);
13198 if(x == (PrefDirSize() - 1))
13207 if((PrefDirRoute ==
PrefDirCall) && BuildingPrefDir)
13209 HPos = GetFixedPrefDirElementAt(4, 0).
HLoc * 16;
13210 VPos = GetFixedPrefDirElementAt(5, 0).VLoc * 16;
13211 Disp->Rectangle(1, HPos, VPos,
clB0G0R5, 2, 2);
13213 if(PrefDirSize() > 1)
13215 unsigned int LatestPos = PrefDirSize() - 1;
13216 HPos = GetFixedPrefDirElementAt(6, LatestPos).HLoc * 16;
13217 VPos = GetFixedPrefDirElementAt(7, LatestPos).VLoc * 16;
13218 Disp->Rectangle(2, HPos, VPos,
clB5G0R0, 4, 2);
13239 int H, V, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13242 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
13246 H = MMIT->first.first;
13247 V = MMIT->first.second;
13250 if(PrefDirPos0 > -1)
13254 if(PrefDirPos1 > -1)
13258 if(PrefDirPos2 > -1)
13262 if(PrefDirPos3 > -1)
13266 if(PrefDirPos3 > -1)
13282 else if(PrefDirPos2 > -1)
13324 else if(PrefDirPos1 > -1)
13347 else if(PrefDirPos0 > -1)
13366 int NumberOfPrefDirElements = 0;
13369 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13371 VecFile >> TempInt;
13374 VecFile >> TempInt;
13375 LoadPrefDirElement.
ELink = TempInt;
13376 VecFile >> TempInt;
13377 LoadPrefDirElement.
ELinkPos = TempInt;
13378 VecFile >> TempInt;
13379 LoadPrefDirElement.
XLink = TempInt;
13380 VecFile >> TempInt;
13381 LoadPrefDirElement.
XLinkPos = TempInt;
13382 VecFile >> TempInt;
13383 LoadPrefDirElement.
EXNumber = TempInt;
13384 VecFile >> TempInt;
13389 if(!(LoadPrefDirElement.
IsARoute))
13415 int NumberOfPrefDirElements = 0;
13418 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13420 VecFile >> TempInt;
13421 VecFile >> TempInt;
13424 VecFile >> TempInt;
13425 LoadPrefDirElement.
ELink = TempInt;
13426 VecFile >> TempInt;
13427 LoadPrefDirElement.
ELinkPos = TempInt;
13428 VecFile >> TempInt;
13429 LoadPrefDirElement.
XLink = TempInt;
13430 VecFile >> TempInt;
13431 LoadPrefDirElement.
XLinkPos = TempInt;
13432 VecFile >> TempInt;
13433 LoadPrefDirElement.
EXNumber = TempInt;
13434 VecFile >> TempInt;
13439 if(!(LoadPrefDirElement.
IsARoute))
13467 int NumberOfPrefDirElements = 0;
13470 if((NumberOfPrefDirElements < 0) || (NumberOfPrefDirElements > 1000000))
13475 for(
int x = 0; x < NumberOfPrefDirElements; x++)
13482 VecFile >> TempInt;
13483 if((TempInt < 0) || (TempInt >= NumberOfActiveElements))
13488 VecFile >> TempInt;
13489 if((TempInt < -1) || (TempInt > 9))
13494 VecFile >> TempInt;
13495 if((TempInt < -1) || (TempInt > 3))
13500 VecFile >> TempInt;
13501 if((TempInt < -1) || (TempInt > 9))
13506 VecFile >> TempInt;
13507 if((TempInt < -1) || (TempInt > 3))
13512 VecFile >> TempInt;
13513 if((TempInt < -1) || (TempInt > 27))
13518 VecFile >> TempInt;
13526 VecFile >> TempInt;
13527 if((TempInt != 0) && (TempInt != 1))
13532 VecFile >> TempInt;
13533 if((TempInt != 0) && (TempInt != 1))
13538 VecFile >> TempInt;
13539 if((TempInt != 0) && (TempInt != 1))
13562 for(
int y = 0; y < NumberOfPrefDirElements; y++)
13564 VecFile << y <<
'\n';
13565 VecFile <<
PrefDirVector.at(y).TrackVectorPosition <<
'\n';
13575 if(y == (NumberOfPrefDirElements - 1))
13577 VecFile <<
"************" <<
'\0' <<
'\n';
13581 VecFile <<
"******" <<
'\0' <<
'\n';
13595 for(
int y = 0; y < NumberOfSearchElements; y++)
13597 VecFile << y <<
'\n';
13598 VecFile <<
SearchVector.at(y).TrackVectorPosition <<
'\n';
13608 if(y == (NumberOfSearchElements - 1))
13610 VecFile <<
"************" <<
'\0' <<
'\n';
13614 VecFile <<
"******" <<
'\0' <<
'\n';
13727 bool AlreadyPresent, FoundFlag;
13728 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
13730 for(
unsigned int x = 0; x < InputPrefDir->
PrefDirSize(); x++)
13734 AlreadyPresent =
false;
13739 AlreadyPresent =
true;
13743 AlreadyPresent =
true;
13747 AlreadyPresent =
true;
13751 AlreadyPresent =
true;
13754 if(!AlreadyPresent)
13801 for(
unsigned int z = 0; z < 4; z++)
13809 throw Exception(
"Error in RebuildPrefDirVector - PrefDirVector is unsafe");
13823 bool DiscrepancyFound =
false;
13834 DiscrepancyFound =
true;
13839 DiscrepancyFound =
true;
13844 DiscrepancyFound =
true;
13849 DiscrepancyFound =
true;
13854 DiscrepancyFound =
true;
13860 DiscrepancyFound =
true;
13863 if(DiscrepancyFound)
13865 ShowMessage(
"Discrepancies found in the preferred direction file, preferred directions will be cleared");
13880 bool DiscrepancyFound =
false;
13891 DiscrepancyFound =
true;
13895 DiscrepancyFound =
true;
13900 DiscrepancyFound =
true;
13905 DiscrepancyFound =
true;
13910 DiscrepancyFound =
true;
13916 DiscrepancyFound =
true;
13920 return(!DiscrepancyFound);
13932 bool FoundFlag =
false;
13933 int PrefDir0, PrefDir1, PrefDir2, PrefDir3;
13941 throw Exception(
"CheckPrefDir4MultiMap Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
13942 " in PrefDir4MultiMap, Caller=" + (AnsiString)Caller);
13944 if((PrefDir0 != (
int)a) && (PrefDir1 != (
int)a) && (PrefDir2 != (
int)a) && (PrefDir3 != (
int)a))
13946 throw Exception(
"CheckPrefDir4MultiMap Error - MapVectorPosition failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
13947 (AnsiString)CheckElement.
VLoc +
" Map values=" + (AnsiString)PrefDir0 +
", " + (AnsiString)PrefDir1 +
", " + (AnsiString)PrefDir2 +
", " +
13948 (AnsiString)PrefDir3 +
" PrefDirVectorPos value=" + (AnsiString)a +
" Caller=" + (AnsiString)Caller);
13953 throw Exception(
"CheckPrefDir4MultiMap Error - Map Size=" + (AnsiString)
PrefDirVector.size() +
" PrefDirVectorSize=" + (AnsiString)
PrefDirVector.size()
13954 +
" Caller=" + (AnsiString)Caller);
13980 PrefDirMapKeyPair.first = HLoc;
13981 PrefDirMapKeyPair.second = VLoc;
13982 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
13985 if(ItPair.first == ItPair.second)
13993 PrefDirPos0 = ItPair.first->second;
13995 if(ItPair.first == ItPair.second)
14000 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14002 PrefDirPos1 = ItPair.first->second;
14005 if(ItPair.first == ItPair.second)
14010 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14012 PrefDirPos2 = ItPair.first->second;
14015 if(ItPair.first == ItPair.second)
14020 if(((ItPair.first->first).first == HLoc) && ((ItPair.first->first).second == VLoc))
14022 PrefDirPos3 = ItPair.first->second;
14037 +
"," + AnsiString(LinkNumberPos));
14039 int PD0, PD1, PD2, PD3;
14040 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
14044 PD0, PD1, PD2, PD3);
14056 LinkedPrefDirVectorNumber = PD0;
14065 LinkedPrefDirVectorNumber = PD1;
14075 LinkedPrefDirVectorNumber = PD0;
14084 LinkedPrefDirVectorNumber = PD1;
14093 LinkedPrefDirVectorNumber = PD2;
14102 LinkedPrefDirVectorNumber = PD3;
14107 LinkedPrefDirVectorNumber = -1;
14113 LinkedPrefDirVectorNumber = -1;
14118 catch(
const Exception &e)
14120 LinkedPrefDirVectorNumber = -1;
14135 +
"," + AnsiString(LinkNumberPos));
14137 int PD0, PD1, PD2, PD3;
14138 if(
PrefDirVector.at(PrefDirVectorNumber).Conn[LinkNumberPos] > -1)
14142 PD0, PD1, PD2, PD3);
14155 LinkedPrefDirVectorNumber = PD0;
14165 LinkedPrefDirVectorNumber = PD1;
14170 LinkedPrefDirVectorNumber = -1;
14178 LinkedPrefDirVectorNumber = PD0;
14187 LinkedPrefDirVectorNumber = PD1;
14196 LinkedPrefDirVectorNumber = PD2;
14205 LinkedPrefDirVectorNumber = PD3;
14210 LinkedPrefDirVectorNumber = -1;
14216 LinkedPrefDirVectorNumber = -1;
14221 catch(
const Exception &e)
14223 LinkedPrefDirVectorNumber = -1;
14235 int PD0, PD1, PD2, PD3;
14287 THVPair PrefDir4MultiMapKeyPair;
14290 PrefDir4MultiMapKeyPair.first = LoadPrefDirElement.
HLoc;
14291 PrefDir4MultiMapKeyPair.second = LoadPrefDirElement.
VLoc;
14292 PrefDir4MultiMapEntry.first = PrefDir4MultiMapKeyPair;
14315 throw Exception(
"Failed to find PrefDir4MultiMap erase element");
14334 AnsiString(ErasedElementNumber));
14339 if(MapPtr->second > ErasedElementNumber)
14361 throw Exception(
"PrefDirVectorPosition out of range");
14364 THVPair PrefDir4MultiMapKeyPair;
14366 PrefDir4MultiMapKeyPair.first = PrefDirElement.
HLoc;
14367 PrefDir4MultiMapKeyPair.second = PrefDirElement.
VLoc;
14368 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
14371 if(ItPair.first == ItPair.second)
14374 return(ItPair.first);
14378 if(ItPair.first->second == PrefDirVectorPosition)
14382 return(ItPair.first);
14385 if(ItPair.first == ItPair.second)
14388 return(ItPair.first);
14390 if(ItPair.first->second == PrefDirVectorPosition)
14394 return(ItPair.first);
14397 if(ItPair.first == ItPair.second)
14400 return(ItPair.first);
14402 if(ItPair.first->second == PrefDirVectorPosition)
14406 return(ItPair.first);
14409 if(ItPair.first == ItPair.second)
14412 return(ItPair.first);
14414 if(ItPair.first->second == PrefDirVectorPosition)
14418 return(ItPair.first);
14422 return(ItPair.first);
14435 THVPair PrefDir4MultiMapKeyPair;
14437 PrefDir4MultiMapKeyPair.first = HLoc;
14438 PrefDir4MultiMapKeyPair.second = VLoc;
14439 std::pair<TPrefDir4MultiMapIterator, TPrefDir4MultiMapIterator>ItPair;
14442 if(ItPair.first == ItPair.second)
14450 return(ItPair.first->second);
14459 bool ErasedFlag =
false;
14461 if(ErasedTrackVectorPosition > -1)
14470 ErasedFlag =
false;
14472 if(
PrefDirVector.at(x).TrackVectorPosition == ErasedTrackVectorPosition)
14477 else if(
PrefDirVector.at(x).Conn[0] == ErasedTrackVectorPosition)
14482 else if(
PrefDirVector.at(x).Conn[1] == ErasedTrackVectorPosition)
14487 else if(
PrefDirVector.at(x).Conn[2] == ErasedTrackVectorPosition)
14492 else if(
PrefDirVector.at(x).Conn[3] == ErasedTrackVectorPosition)
14500 if(
PrefDirVector.at(x).TrackVectorPosition > ErasedTrackVectorPosition)
14504 if(
PrefDirVector.at(x).Conn[0] > ErasedTrackVectorPosition)
14508 if(
PrefDirVector.at(x).Conn[1] > ErasedTrackVectorPosition)
14512 if(
PrefDirVector.at(x).Conn[2] > ErasedTrackVectorPosition)
14516 if(
PrefDirVector.at(x).Conn[3] > ErasedTrackVectorPosition)
14531 OverallDistance = 0;
14532 OverallSpeedLimit = 0;
14533 LeadingPointsAtLastElement =
false;
14541 LeadingPointsAtLastElement =
true;
14550 OverallDistance += PrefDirElement.
Length23;
14551 if(OverallSpeedLimit != -1)
14561 OverallSpeedLimit = -1;
14568 OverallDistance += PrefDirElement.
Length01;
14569 if(OverallSpeedLimit != -1)
14579 OverallSpeedLimit = -1;
14598 int H, V, HLoc, VLoc, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14601 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
14605 HLoc = MMIT->first.first;
14606 VLoc = MMIT->first.second;
14611 if(PrefDirPos0 > -1)
14615 if(PrefDirPos1 > -1)
14619 if(PrefDirPos2 > -1)
14623 if(PrefDirPos3 > -1)
14627 if(PrefDirPos3 > -1)
14630 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14632 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14634 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14636 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement3.
GetRouteGraphicPtr(
false,
true));
14643 else if(PrefDirPos2 > -1)
14648 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14650 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14652 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
false));
14661 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14663 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14665 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14674 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14676 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement2.
GetRouteGraphicPtr(
false,
true));
14678 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14685 else if(PrefDirPos1 > -1)
14690 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
true));
14692 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
true));
14700 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14702 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement1.
GetRouteGraphicPtr(
false,
false));
14708 else if(PrefDirPos0 > -1)
14710 Bitmap->Canvas->Draw((H * 16), (V * 16), PrefDirElement0.
GetRouteGraphicPtr(
false,
false));
14727 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14730 TPrefDirElement PrefDirElement0, PrefDirElement1, PrefDirElement2, PrefDirElement3;
14752 if(PrefDirPos0 > -1)
14756 if(PrefDirPos1 > -1)
14760 if(PrefDirPos2 > -1)
14764 if(PrefDirPos3 > -1)
14768 if(PrefDirPos3 > -1)
14773 else if(PrefDirPos2 > -1)
14775 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos) || (PrefDirElement2.
XLinkPos == EntryPos))
14786 else if(PrefDirPos1 > -1)
14788 if((PrefDirElement0.
XLinkPos == EntryPos) || (PrefDirElement1.
XLinkPos == EntryPos))
14799 else if(PrefDirPos0 > -1)
14801 if(PrefDirElement0.
XLinkPos == EntryPos)
14838 ElementIn.
VLoc +
"," + XLink);
14840 bool TrackFoundFlag;
14843 if((XLink == 2) || (XLink == 4) || (XLink == 6) || (XLink == 8))
14855 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14865 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
14879 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
14889 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
14903 if((TempTrackElement.
Link[0] == 9) || (TempTrackElement.
Link[1] == 9) || (TempTrackElement.
Link[2] == 9) || (TempTrackElement.
Link[3] == 9))
14913 if((TempTrackElement.
Link[0] == 1) || (TempTrackElement.
Link[1] == 1) || (TempTrackElement.
Link[2] == 1) || (TempTrackElement.
Link[3] == 1))
14927 if((TempTrackElement.
Link[0] == 7) || (TempTrackElement.
Link[1] == 7) || (TempTrackElement.
Link[2] == 7) || (TempTrackElement.
Link[3] == 7))
14937 if((TempTrackElement.
Link[0] == 3) || (TempTrackElement.
Link[1] == 3) || (TempTrackElement.
Link[2] == 3) || (TempTrackElement.
Link[3] == 3))
14960 bool FoundFlag, ContFlag, FoundElements =
false;
14961 int PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3;
14966 LastIteratorValue++;
14992 if(PDVIt->XLinkPos == 0)
14997 StartElement = *PDVIt;
15006 int NextTrackVectorPosition = PDVIt->
Conn[PDVIt->GetXLinkPos()];
15008 Track->
TrackElementAt(879, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15009 if(PrefDirPos0 == -1)
15013 bool NextElementFoundFlag =
false;
15017 NextElementFoundFlag =
true;
15019 if(PrefDirPos1 > -1)
15024 NextElementFoundFlag =
true;
15027 if(PrefDirPos2 > -1)
15032 NextElementFoundFlag =
true;
15035 if(PrefDirPos3 > -1)
15040 NextElementFoundFlag =
true;
15043 if(!NextElementFoundFlag)
15073 EndElement = NextElement;
15077 NextTrackVectorPosition = NextElement.
Conn[NextElement.
GetXLinkPos()];
15079 Track->
TrackElementAt(881, NextTrackVectorPosition).
VLoc, FoundFlag, PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15080 if(PrefDirPos0 == -1)
15090 if(PrefDirPos1 > -1)
15098 if(PrefDirPos2 > -1)
15106 if(PrefDirPos3 > -1)
15137 FoundElements =
true;
15171 AnsiString(VLoc) +
"," + AnsiString((
short)AutoSigsFlag));
15173 int TrackVectorPosition;
15209 int LockedVectorNumber;
15232 bool InPrefDirFlag =
false;
15235 int PrefDirPos0 = -1;
15236 int PrefDirPos1 = -1;
15237 int PrefDirPos2 = -1;
15238 int PrefDirPos3 = -1;
15242 int PrefDirVecPos[4] =
15244 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15247 for(
int x = 0; x < 4; x++)
15249 int b = PrefDirVecPos[x];
15259 InPrefDirFlag =
true;
15272 TrainController->
StopTTClockMessage(12,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
15280 if(DummyPair.first > -1)
15282 throw Exception(
"Selection in two routes - should never happen!");
15284 if(RoutePair.first > -1)
15360 IDInt &ReqPosRouteID,
bool &PointsChanged)
15394 AnsiString(VLoc) +
"," + AnsiString((
short)ConsecSignals) +
"," + AnsiString((
short)AutoSigsFlag));
15396 int NewFailedPointsTVPos = -1;
15445 bool InPrefDirFlag =
false;
15448 int PrefDirPos0 = -1;
15449 int PrefDirPos1 = -1;
15450 int PrefDirPos2 = -1;
15451 int PrefDirPos3 = -1;
15454 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3);
15455 int PrefDirVecPos[4] =
15457 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
15460 for(
int x = 0; x < 4; x++)
15462 int b = PrefDirVecPos[x];
15465 InPrefDirFlag =
true;
15478 TrainController->
StopTTClockMessage(23,
"Route and preferred direction mismatch. If no preferred direction then only red routes can be used. Green and blue route directions must correspond to the preferred direction.");
15487 if(RoutePair.first > -1)
15489 if(RoutePair.second != 0)
15506 EndElement1 = RouteElement;
15507 EndElement2 = BlankElement;
15602 AutoSigsFlag,
false))
15607 if(NewFailedPointsTVPos > -1)
15611 " failed during route setting.");
15615 PointsChanged =
true;
15638 AutoSigsFlag,
false))
15643 if(NewFailedPointsTVPos > -1)
15647 " failed during route setting.");
15651 PointsChanged =
true;
15669 AutoSigsFlag,
false))
15674 if(NewFailedPointsTVPos > -1)
15678 " failed during route setting.");
15682 PointsChanged =
true;
15706 AutoSigsFlag,
false))
15711 if(NewFailedPointsTVPos > -1)
15715 " failed during route setting.");
15719 PointsChanged =
true;
15728 AutoSigsFlag,
false))
15733 if(NewFailedPointsTVPos > -1)
15737 " failed during route setting.");
15741 PointsChanged =
true;
15752 AutoSigsFlag,
false))
15757 if(NewFailedPointsTVPos > -1)
15761 " failed during route setting.");
15765 PointsChanged =
true;
15771 AutoSigsFlag,
false))
15776 if(NewFailedPointsTVPos > -1)
15780 " failed during route setting.");
15784 PointsChanged =
true;
15795 AutoSigsFlag,
false))
15800 if(NewFailedPointsTVPos > -1)
15804 " failed during route setting.");
15808 PointsChanged =
true;
15862 TOnePrefDir *EveryPrefDir,
bool ConsecSignals,
int EndPosition,
bool AutoSigsFlag,
bool RecursiveCall)
15914 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString(
ReqPosRouteID.
GetInt()) +
"," + AnsiString(EndPosition) +
"," +
15915 AnsiString((
short)AutoSigsFlag) +
"," + AnsiString((
short)RecursiveCall));
15916 int VectorCount = 0;
15925 if((PrefDirElement.
XLink == 1) || (PrefDirElement.
XLink == 3) || (PrefDirElement.
XLink == 7) || (PrefDirElement.
XLink == 9))
15929 for(
int x = 0; x < VectorCount; x++)
15937 bool FirstPass =
true;
15947 for(
int x = 0; x < VectorCount; x++)
15956 for(
int x = 0; x < VectorCount; x++)
15968 for(
int x = 0; x < VectorCount; x++)
15976 int NextPosition = PrefDirElement.
Conn[XLinkPos];
15980 int NextELinkPos = PrefDirElement.
ConnLinkPos[XLinkPos];
15981 SearchElement.
ELinkPos = NextELinkPos;
15982 SearchElement.
ELink = SearchElement.
Link[NextELinkPos];
16003 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
16005 SearchElement.
XLinkPos = NextXLinkPos;
16022 for(
int x = 0; x < VectorCount; x++)
16038 for(
int x = 0; x < VectorCount; x++)
16052 if(RoutePair.first > -1)
16061 for(
int x = 0; x < VectorCount; x++)
16070 if(SecondPair.first > -1)
16079 for(
int x = 0; x < VectorCount; x++)
16093 for(
int x = 0; x < VectorCount; x++)
16104 for(
int x = 0; x < VectorCount; x++)
16113 for(
int x = 0; x < VectorCount; x++)
16122 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16126 for(
int x = 0; x < VectorCount; x++)
16136 bool InPrefDirFlag =
false;
16137 PrefDirElement1 = BlankElement;
16138 PrefDirElement2 = BlankElement;
16141 int PrefDirPos0 = -1;
16142 int PrefDirPos1 = -1;
16143 int PrefDirPos2 = -1;
16144 int PrefDirPos3 = -1;
16147 int PrefDirVecPos[4] =
16149 PrefDirPos0, PrefDirPos1, PrefDirPos2, PrefDirPos3
16151 for(
int x = 0; x < 4; x++)
16153 int b = PrefDirVecPos[x];
16156 InPrefDirFlag =
true;
16169 for(
int x = 0; x < VectorCount; x++)
16181 for(
int x = 0; x < VectorCount; x++)
16197 for(
int x = 0; x < VectorCount; x++)
16208 for(
int x = 0; x < VectorCount; x++)
16228 for(
int x = 0; x < VectorCount; x++)
16241 for(
int x = 0; x < VectorCount; x++)
16255 for(
int x = 0; x < VectorCount; x++)
16265 for(
int x = 0; x < VectorCount; x++)
16296 for(
int x = 0; x < VectorCount; x++)
16305 for(
int x = 0; x < VectorCount; x++)
16317 int SearchPos1 = SearchElement.
Attribute + 1;
16319 if(SearchPos1 == 2)
16323 if(SearchPos1 == 1)
16331 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
16332 SearchElement.
XLinkPos = SearchPos1;
16333 InPrefDirFlag =
false;
16334 if(SearchElement.
XLink == PrefDirElement1.
XLink)
16336 SearchElement = PrefDirElement1;
16337 InPrefDirFlag =
true;
16339 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
16341 SearchElement = PrefDirElement2;
16342 InPrefDirFlag =
true;
16348 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16352 for(
int x = 0; x < VectorCount; x++)
16370 AutoSigsFlag,
true))
16379 for(
int x = 0; x < VectorCount; x++)
16388 for(
int x = 0; x < VectorCount; x++)
16408 for(
int x = 0; x < VectorCount; x++)
16418 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
16419 SearchElement.
XLinkPos = SearchPos2;
16420 if(SearchElement.
XLink == PrefDirElement1.
XLink)
16422 SearchElement = PrefDirElement1;
16424 else if(SearchElement.
XLink == PrefDirElement2.
XLink)
16426 SearchElement = PrefDirElement2;
16430 for(
int x = 0; x < VectorCount; x++)
16438 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
16442 for(
int x = 0; x < VectorCount; x++)
16461 AutoSigsFlag,
true))
16470 for(
int x = 0; x < VectorCount; x++)
16479 for(
int x = 0; x < VectorCount; x++)
16491 for(
int x = 0; x < VectorCount; x++)
16501 SearchElement = PrefDirElement1;
16510 XLinkPos = SearchElement.
XLinkPos;
16511 PrefDirElement = SearchElement;
16568 unsigned int TruncatePrefDirPosition = 0;
16641 throw Exception(
"Error - failed to validate extended route for preferred route");
16696 throw Exception(
"Error - failed to validate single route for preferred route");
16741 AnsiString(VLoc) +
"," + AnsiString((
short)Callon));
16743 int TrackVectorPosition;
16780 int LockedVectorNumber;
16814 PrefDirElement1.
ELink = PrefDirElement1.
Link[0];
16815 PrefDirElement1.
XLink = PrefDirElement1.
Link[1];
16818 throw Exception(
"Error, No EXNumber for PrefDirElement1 in GetNonPreferredRouteStartElement");
16824 PrefDirElement2.
ELink = PrefDirElement2.
Link[1];
16825 PrefDirElement2.
XLink = PrefDirElement2.
Link[0];
16828 throw Exception(
"Error, No EXNumber for PrefDirElement2 in GetNonPreferredRouteStartElement");
16842 if(RoutePair.first > -1)
16977 int NewFailedPointsTVPos = -1;
17042 EndElement1.
ELink = EndElement1.
Link[0];
17043 EndElement1.
XLink = EndElement1.
Link[1];
17046 throw Exception(
"Error, No EXNumber for EndElement1 in GetNonPreferredRouteStartElement");
17051 EndElement2.
ELink = EndElement2.
Link[1];
17052 EndElement2.
XLink = EndElement2.
Link[0];
17055 throw Exception(
"Error, No EXNumber for EndElement2 in GetNonPreferredRouteStartElement");
17099 if(RoutePair.first > -1)
17101 if(RoutePair.second != 0)
17124 EndElement2 = BlankElement;
17209 if(NewFailedPointsTVPos > -1)
17213 " failed during route setting.");
17217 PointsChanged =
true;
17243 if(NewFailedPointsTVPos > -1)
17247 " failed during route setting.");
17251 PointsChanged =
true;
17273 if(NewFailedPointsTVPos > -1)
17277 " failed during route setting.");
17281 PointsChanged =
true;
17307 if(NewFailedPointsTVPos > -1)
17311 " failed during route setting.");
17315 PointsChanged =
true;
17329 if(NewFailedPointsTVPos > -1)
17333 " failed during route setting.");
17337 PointsChanged =
true;
17377 AnsiString(XLinkPos) +
"," + AnsiString(RequiredPosition) +
"," + AnsiString() +
"," + AnsiString(
ReqPosRouteID.
GetInt()));
17378 int VectorCount = 0;
17381 if((CurrentTrackElement.
Link[XLinkPos] == 1) || (CurrentTrackElement.
Link[XLinkPos] == 3) || (CurrentTrackElement.
Link[XLinkPos] == 7) ||
17382 (CurrentTrackElement.
Link[XLinkPos] == 9))
17386 for(
int x = 0; x < VectorCount; x++)
17398 for(
int x = 0; x < VectorCount; x++)
17405 if(CurrentTrackElement.
Config[XLinkPos] ==
End)
17407 for(
int x = 0; x < VectorCount; x++)
17414 int NextPosition = CurrentTrackElement.
Conn[XLinkPos];
17418 int NextELinkPos = CurrentTrackElement.
ConnLinkPos[XLinkPos];
17419 SearchElement.
ELinkPos = NextELinkPos;
17440 SearchElement.
XLink = SearchElement.
Link[NextXLinkPos];
17442 SearchElement.
XLinkPos = NextXLinkPos;
17460 for(
int x = 0; x < VectorCount; x++)
17476 for(
int x = 0; x < VectorCount; x++)
17490 if(RoutePair.first > -1)
17499 for(
int x = 0; x < VectorCount; x++)
17508 if(SecondPair.first > -1)
17517 for(
int x = 0; x < VectorCount; x++)
17531 for(
int x = 0; x < VectorCount; x++)
17542 for(
int x = 0; x < VectorCount; x++)
17551 for(
int x = 0; x < VectorCount; x++)
17560 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17564 for(
int x = 0; x < VectorCount; x++)
17577 for(
int x = 0; x < VectorCount; x++)
17605 for(
int x = 0; x < VectorCount; x++)
17618 for(
int x = 0; x < VectorCount; x++)
17628 for(
int x = 0; x < VectorCount; x++)
17653 for(
int x = 0; x < VectorCount; x++)
17662 for(
int x = 0; x < VectorCount; x++)
17675 int SearchPos1 = SearchElement.
Attribute + 1;
17677 if(SearchPos1 == 2)
17681 if(SearchPos1 == 1)
17690 SearchElement.
XLink = SearchElement.
Link[SearchPos1];
17691 SearchElement.
XLinkPos = SearchPos1;
17693 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17697 for(
int x = 0; x < VectorCount; x++)
17715 for(
int x = 0; x < VectorCount; x++)
17731 SearchElement.
XLink = SearchElement.
Link[SearchPos2];
17732 SearchElement.
XLinkPos = SearchPos2;
17734 if((SearchElement.
XLink == 1) || (SearchElement.
XLink == 3) || (SearchElement.
XLink == 7) || (SearchElement.
XLink == 9))
17738 for(
int x = 0; x < VectorCount; x++)
17754 for(
int x = 0; x < VectorCount; x++)
17766 for(
int x = 0; x < VectorCount; x++)
17781 CurrentTrackElement = SearchElement;
17782 XLinkPos = SearchElement.
XLinkPos;
17804 throw Exception(
"Error, SearchVector empty");
17816 for(
int x = 0; x < 4; x++)
17858 throw Exception(
"Error in EntryExitNumber 3");
17913 unsigned int TruncatePrefDirPosition = 0;
17973 throw Exception(
"Failed to validate extended route for nonpreferred route");
18018 throw Exception(
"Failed to validate single route for nonpreferred route");
18038 if(!PrefDirVector.empty())
18042 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 1) || (PrefDirPtr->XLinkPos == 1)))
18047 if((PrefDirPtr->TrackType ==
Points) && ((PrefDirPtr->ELinkPos == 3) || (PrefDirPtr->XLinkPos == 3)))
18064 if(!PrefDirVector.empty())
18069 GetFixedPrefDirElementAt(193, 0).XLinkPos, RouteNumber);
18086 NewFailedPointsTVPos = -1;
18087 bool PointsChanged =
false;
18095 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 1) || (SearchPtr->XLinkPos == 1)))
18105 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
18106 IFE.
TVPos = NewFailedPointsTVPos;
18125 PointsChanged =
true;
18128 if((SearchPtr->TrackType ==
Points) && ((SearchPtr->ELinkPos == 3) || (SearchPtr->XLinkPos == 3)))
18138 NewFailedPointsTVPos = SearchPtr->TrackVectorPosition;
18139 IFE.
TVPos = NewFailedPointsTVPos;
18158 PointsChanged =
true;
18164 return(PointsChanged);
18188 NextForwardLinkedRouteNumber = -1;
18189 for(
unsigned int x = StartPos; x < PrefDirSize(); x++)
18191 int TrainID =
Track->
TrackElementAt(100, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnElement;
18192 if(PrefDirVector.at(x).TrackType ==
Bridge)
18194 if(PrefDirVector.at(x).XLinkPos < 2)
18196 TrainID =
Track->
TrackElementAt(101, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit01;
18200 TrainID =
Track->
TrackElementAt(102, PrefDirVector.at(x).TrackVectorPosition).TrainIDOnBridgeOrFailedPointOrigSpeedLimit23;
18208 if(PrefDirVector.at(x).TrackType ==
Buffers)
18220 if(
Track->
IsLCAtHV(42, PrefDirVector.at(x).HLoc, PrefDirVector.at(x).VLoc))
18229 if(PrefDirVector.at(x).Config[PrefDirVector.at(x).XLinkPos] ==
Signal)
18231 Attribute =
Track->
TrackElementAt(103, PrefDirVector.at(x).TrackVectorPosition).Attribute;
18243 if(x == PrefDirSize() - 1)
18246 NextForwardLinkedRouteNumber = -1;
18294 AnsiString(PrefDirVectorStartPosition));
18300 if(!PrefDirVector.empty())
18302 if(!SkipForwardLook)
18304 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr < PrefDirVector.end(); PrefDirPtr++)
18307 if(PrefDirPtr->TrackType ==
Bridge)
18309 if(PrefDirPtr->XLinkPos < 2)
18320 SkipForwardLook =
true;
18328 SkipForwardLook =
true;
18331 int NextForwardLinkedRouteNumber = -1;
18332 if((
unsigned int)PrefDirVectorStartPosition == PrefDirSize() - 1)
18334 TPrefDirElement PDE = GetFixedPrefDirElementAt(267, PrefDirVectorStartPosition);
18339 SkipForwardLook =
true;
18340 if(PrefDirVector.back().TrackType ==
Buffers)
18346 bool SetAttributeTo3 =
true;
18357 SetAttributeTo3 =
false;
18358 Attribute = AutoSigVectorIT->AccessNumber;
18364 if(SetAttributeTo3)
18375 SkipForwardLook =
true;
18376 if(PrefDirVector.back().TrackType ==
Buffers)
18389 if(!SkipForwardLook)
18394 if((
unsigned int)PrefDirVectorStartPosition < (PrefDirSize() - 1))
18396 StartPos = PrefDirVectorStartPosition + 1;
18404 if(!FindForwardTargetSignalAttribute(2, NextForwardLinkedRouteNumber, Attribute, StartPos))
18423 for(
TPrefDirVectorConstIterator PrefDirPtr = (PrefDirVector.begin() + PrefDirVectorStartPosition); PrefDirPtr >= PrefDirVector.begin(); PrefDirPtr--)
18426 if(PrefDirPtr->TrackType ==
Bridge)
18428 if(PrefDirPtr->XLinkPos < 2)
18444 if(
Track->
IsLCAtHV(20, PrefDirPtr->HLoc, PrefDirPtr->VLoc))
18453 if(PrefDirPtr->Config[PrefDirPtr->XLinkPos] ==
Signal)
18456 PrefDirPtr->PrefDirRoute)
18460 int LockedVecNum = 0;
18462 bool KeepAttributeAt0ForLockedRoute =
false;
18467 KeepAttributeAt0ForLockedRoute =
true;
18472 bool NotGroundSignal =
false;
18475 NotGroundSignal =
true;
18500 if((Attribute < 3) && !KeepAttributeAt0ForLockedRoute && (NotGroundSignal || (Attribute == 0)))
18529 "," + AnsiString((
short)PrefDirRoute));
18530 bool ElementInRoute =
false;
18531 bool MovingTrainOccupyingRoute =
false;
18532 unsigned int TruncatePDElementPos;
18533 enum {NoTruncate, BackTruncate, FrontTruncate, FullTruncate} TruncateType;
18534 TruncateType = NoTruncate;
18541 TruncatePDElementPos = b;
18542 ElementInRoute =
true;
18546 if(!ElementInRoute)
18556 if(TruncatePDElementPos == 0)
18558 TruncateType = FullTruncate;
18566 TruncateType = FrontTruncate;
18570 TruncateType = BackTruncate;
18577 TruncateType = BackTruncate;
18583 if(TruncateType == BackTruncate)
18603 MovingTrainOccupyingRoute =
true;
18614 if(b ==
int(TruncatePDElementPos))
18620 else if(TruncateType == FrontTruncate)
18640 MovingTrainOccupyingRoute =
true;
18651 if(b == TruncatePDElementPos)
18677 MovingTrainOccupyingRoute =
true;
18699 if(((TruncatePDElementPos == 1) && (TruncateType == BackTruncate)) || ((TruncatePDElementPos == (
PrefDirSize() - 2)) && (TruncateType == FrontTruncate)))
18708 if((TruncatePDElementPos > 0) && (TruncateType == BackTruncate))
18715 TrainController->
StopTTClockMessage(145,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
18716 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
18717 "that lies within the route;\n\nor to remove the whole route select the first track element in the route");
18737 else if((TruncatePDElementPos < (
PrefDirSize() - 1)) && (TruncateType == FrontTruncate))
18744 TrainController->
StopTTClockMessage(146,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
18745 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
18746 "that lies within the route;\n\nor to remove the whole route select the first track element in the route");
18755 if(TruncatePDElementPos > 0)
18770 else if(TruncatePDElementPos == 0)
18777 TrainController->
StopTTClockMessage(148,
"Invalid green or blue route truncation position:\n\nto truncate from the start of the route select a position immediately before a facing signal "
18778 "that lies within the route;\n\nto truncate to the end of the route select a position immediately after a facing signal "
18779 "that lies within the route;\n\nor to remove the whole route select the first track element in the route");
18799 int ThisRouteNumber;
18809 if(LRVIT->RouteNumber == ThisRouteNumber)
18820 unsigned int LookBackwardsFromHere = 0;
18821 if(TruncateType == BackTruncate)
18823 LookBackwardsFromHere = TruncatePDElementPos;
18835 int button = Application->MessageBox(L
"Moving train approaching or occupying route, YES to lock route (2 minutes to release), NO to cancel",
18836 L
"Warning!", MB_YESNO | MB_ICONWARNING);
18849 bool ExistingLockedRouteModified =
false;
18851 if(TruncateType == BackTruncate)
18857 else if(TruncateType == FrontTruncate)
18878 if(LRVIT->RouteNumber == ThisRouteNumber)
18882 ExistingLockedRouteModified =
true;
18886 if(!ExistingLockedRouteModified)
18890 if(TruncateType == BackTruncate)
18893 RearPosition = TruncatePDElementPos;
18896 else if(TruncateType == FrontTruncate)
18900 FrontPosition = TruncatePDElementPos;
18909 for(
int c = FrontPosition; c >= RearPosition; c--)
18927 if(TruncateType == BackTruncate)
18929 RearPosition = TruncatePDElementPos;
18933 else if(TruncateType == FrontTruncate)
18936 FrontPosition = TruncatePDElementPos;
18953 for(
int c = FrontPosition; c >= RearPosition; c--)
18997 TPrefDirElement NewGreenFirstPDElement, NewRedFirstPDElement, NewGreenLastPDElement, NewRedLastPDElement;
19010 if(RouteColour == 1)
19012 NewRedFirstPDElement = LastPDElement;
19016 NewRedFirstPDElement.
IsARoute =
true;
19022 if(R2MMIt->second.first ==
int(x))
19024 R2MMIt->second.second++;
19031 else if(RouteColour == 2)
19033 NewGreenFirstPDElement = LastPDElement;
19037 NewGreenFirstPDElement.
IsARoute =
true;
19043 if(R2MMIt->second.first ==
int(x))
19045 R2MMIt->second.second++;
19068 if(RouteColour == 1)
19070 NewRedLastPDElement = FirstPDElement;
19079 else if(RouteColour == 2)
19081 NewGreenLastPDElement = FirstPDElement;
19150 ARVIt->SetRouteSignals(14);
19169 AnsiString((
short)PrefDirRoute));
19194 AnsiString((
short)PrefDirRoute));
19204 RouteFlashElement.
HLoc = H;
19205 RouteFlashElement.
VLoc = V;
19221 int H = PrefDirPtr->HLoc;
19222 int V = PrefDirPtr->VLoc;
19289 for(
unsigned int x = 0; x < RouteFlashVector.size(); x++)
19295 Display->
PlotOutput(21, RouteFlashVector.at(x).HLoc * 16, RouteFlashVector.at(x).VLoc * 16, RouteFlashVector.at(x).OriginalGraphic);
19298 OverlayPlotted =
false;
19321 bool FirstSignalFound =
false;
19328 if(PDVIt->TrackType ==
Points)
19330 if((PDVIt->ELinkPos == 1) || (PDVIt->XLinkPos == 1))
19341 else if((PDVIt->ELinkPos == 3) || (PDVIt->XLinkPos == 3))
19356 int XLinkPosition = PDVIt->XLinkPos;
19357 if(PDVIt->XLinkPos == -1)
19361 for(
int x = 0; x < 4; x++)
19363 if(PDVIt->Conn[x] == (PDVIt + 1)->TrackVectorPosition)
19376 if(XLinkPosition > -1)
19378 if(!FirstSignalFound && (PDVIt->Config[XLinkPosition] ==
Signal))
19380 FirstSignalFound =
true;
19383 else if(FirstSignalFound && (PDVIt->Config[XLinkPosition] ==
Signal))
19394 IFE.
TVPos = PDVIt->TrackVectorPosition;
19400 " failed when changing aspect.\nTrains can only pass under signaller control.");
19430 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
19432 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetFixedRouteAt");
19435 return(AllRoutesVector.at(At));
19443 if((At < 0) || ((
unsigned int)At >= AllRoutesVector.size()))
19445 throw Exception(
"Out of Range Error, vector size: " + AnsiString(AllRoutesVector.size()) +
", At: " + AnsiString(At) +
" in GetModifiableRouteAt");
19448 return(AllRoutesVector.at(At));
19459 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19461 GetFixedRouteAt(62, a).PrefDirMarker(7,
RouteCall,
false, Disp);
19471 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19473 GetFixedRouteAt(166, a).RouteImageMarker(0, Bitmap);
19491 AnsiString(VLoc) +
"," + AnsiString((
short)PrefDirRoute));
19492 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
19496 GetModifiableRouteAt(7, a).TruncateRoute(0, HLoc, VLoc, PrefDirRoute, ReturnFlag);
19525 AnsiString(LinkPos));
19526 if(TrackVectorPosition == -1)
19531 THVPair Route2MultiMapKeyPair;
19535 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
19538 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
19548 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
19550 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
19553 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(64, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(88,
19554 Route2MultiMapIterator->second.second);
19555 EntryLinkPos = PrefDirElement1.
ELinkPos;
19556 ExitLinkPos = PrefDirElement1.
XLinkPos;
19557 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
19558 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
19570 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
19582 Graphics::TBitmap* &EntryDirectionGraphicPtr)
19592 AnsiString(LinkPos));
19595 if(TrackVectorPosition == -1)
19600 THVPair Route2MultiMapKeyPair;
19604 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
19607 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
19612 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
19614 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
19616 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(73, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(97,
19617 Route2MultiMapIterator->second.second);
19618 EntryLinkPos = PrefDirElement1.
ELinkPos;
19619 ExitLinkPos = PrefDirElement1.
XLinkPos;
19620 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
19621 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
19625 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(74,
19626 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
19633 return(AutoSigsRoute);
19638 return(NotAutoSigsRoute);
19644 if((Route2MultiMapIterator->second.second == 0) || (Route2MultiMapIterator->second.second == GetFixedRouteAt(75,
19645 Route2MultiMapIterator->second.first).PrefDirSize() - 1))
19652 return(AutoSigsRoute);
19657 return(NotAutoSigsRoute);
19661 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
19663 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
19664 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
19666 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(76, ItPair.first->second.first).GetFixedPrefDirElementAt(98, ItPair.first->second.second);
19667 EntryLinkPos = PrefDirElement2.
ELinkPos;
19668 ExitLinkPos = PrefDirElement2.
XLinkPos;
19669 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
19670 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
19674 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(77, ItPair.first->second.first).PrefDirSize() - 1))
19681 return(AutoSigsRoute);
19686 return(NotAutoSigsRoute);
19692 if((ItPair.first->second.second == 0) || (ItPair.first->second.second == GetFixedRouteAt(78, ItPair.first->second.first).PrefDirSize() - 1))
19699 return(AutoSigsRoute);
19704 return(NotAutoSigsRoute);
19708 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(79, ItPair.second->second.first).GetFixedPrefDirElementAt(99, ItPair.second->second.second);
19709 EntryLinkPos = PrefDirElement3.
ELinkPos;
19710 ExitLinkPos = PrefDirElement3.
XLinkPos;
19711 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
19712 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
19716 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(80, ItPair.second->second.first).PrefDirSize() - 1))
19723 return(AutoSigsRoute);
19728 return(NotAutoSigsRoute);
19734 if((ItPair.second->second.second == 0) || (ItPair.second->second.second == GetFixedRouteAt(81, ItPair.second->second.first).PrefDirSize() - 1))
19741 return(AutoSigsRoute);
19746 return(NotAutoSigsRoute);
19762 AnsiString(LinkPos));
19763 if(TrackVectorPosition == -1)
19769 THVPair Route2MultiMapKeyPair;
19773 int EntryLink, EntryLinkPos, ExitLink, ExitLinkPos;
19776 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
19782 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
19784 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
19786 const TPrefDirElement &PrefDirElement1 = GetFixedRouteAt(82, Route2MultiMapIterator->second.first).GetFixedPrefDirElementAt(100,
19787 Route2MultiMapIterator->second.second);
19788 EntryLinkPos = PrefDirElement1.
ELinkPos;
19789 ExitLinkPos = PrefDirElement1.
XLinkPos;
19790 EntryLink = PrefDirElement1.
Link[EntryLinkPos];
19791 ExitLink = PrefDirElement1.
Link[ExitLinkPos];
19794 RouteNumber = Route2MultiMapIterator->second.first;
19798 return(AutoSigsRoute);
19803 return(NotAutoSigsRoute);
19808 RouteNumber = Route2MultiMapIterator->second.first;
19812 return(AutoSigsRoute);
19817 return(NotAutoSigsRoute);
19821 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
19823 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
19824 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
19826 const TPrefDirElement &PrefDirElement2 = GetFixedRouteAt(83, ItPair.first->second.first).GetFixedPrefDirElementAt(101, ItPair.first->second.second);
19827 EntryLinkPos = PrefDirElement2.
ELinkPos;
19828 ExitLinkPos = PrefDirElement2.
XLinkPos;
19829 EntryLink = PrefDirElement2.
Link[EntryLinkPos];
19830 ExitLink = PrefDirElement2.
Link[ExitLinkPos];
19833 RouteNumber = ItPair.first->second.first;
19837 return(AutoSigsRoute);
19842 return(NotAutoSigsRoute);
19847 RouteNumber = ItPair.first->second.first;
19851 return(AutoSigsRoute);
19856 return(NotAutoSigsRoute);
19860 const TPrefDirElement &PrefDirElement3 = GetFixedRouteAt(84, ItPair.second->second.first).GetFixedPrefDirElementAt(102, ItPair.second->second.second);
19861 EntryLinkPos = PrefDirElement3.
ELinkPos;
19862 ExitLinkPos = PrefDirElement3.
XLinkPos;
19863 EntryLink = PrefDirElement3.
Link[EntryLinkPos];
19864 ExitLink = PrefDirElement3.
Link[ExitLinkPos];
19867 RouteNumber = ItPair.second->second.first;
19871 return(AutoSigsRoute);
19876 return(NotAutoSigsRoute);
19881 RouteNumber = ItPair.second->second.first;
19885 return(AutoSigsRoute);
19890 return(NotAutoSigsRoute);
19912 EmptyRoute.
RouteID = NextRouteID;
19915 AllRoutesVector.push_back(EmptyRoute);
19916 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
19941 AllRoutesVector.push_back(EmptyRoute);
19942 for(
unsigned int x = 0; x < Route->
PrefDirSize(); x++)
19965 THVPair Route2MultiMapKeyPair;
19974 LockedRouteRearTrackVectorPosition = 0;
19975 LockedRouteLastTrackVectorPosition = 0;
19976 LockedRouteLastXLinkPos = 0;
19977 LockedRouteLockStartTime = TDateTime(0);
19978 if(!LockedRouteVector.empty())
19982 if(LRVIT->RouteNumber == RouteNumber)
19984 LockedRouteRearTrackVectorPosition = LRVIT->RearTrackVectorPosition;
19985 LockedRouteLastTrackVectorPosition = LRVIT->LastTrackVectorPosition;
19986 LockedRouteLastXLinkPos = LRVIT->LastXLinkPos;
19987 LockedRouteLockStartTime = LRVIT->LockStartTime;
19988 LockedRouteFoundDuringRouteBuilding =
true;
19989 LockedRouteVector.erase(LRVIT);
20014 AnsiString(VLoc) +
"," + AnsiString(ELink));
20017 ReturnPair.first = -1;
20018 ReturnPair.second = 0;
20019 THVPair Route2MultiMapKeyPair;
20021 Route2MultiMapKeyPair.first = HLoc;
20022 Route2MultiMapKeyPair.second = VLoc;
20025 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
20026 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20028 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20029 Route2MultiMapIterator = ItPair.first;
20031 if(ItPair.first == ItPair.second)
20033 throw Exception(
"Failed to find Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc);
20035 if(GetFixedRouteAt(111, ItPair.first->second.first).GetFixedPrefDirElementAt(132, ItPair.first->second.second).GetELink() == ELink)
20037 ReturnPair.first = ItPair.first->second.first;
20038 ReturnPair.second = ItPair.first->second.second;
20039 Route2MultiMapIterator = ItPair.first;
20041 return(ReturnPair);
20044 if(ItPair.first == ItPair.second)
20046 throw Exception(
"Found Route2MultiMap element at HLoc = " + (AnsiString)HLoc +
" VLoc = " + (AnsiString)VLoc +
" but failed to find required element");
20048 if(GetFixedRouteAt(112, ItPair.first->second.first).GetFixedPrefDirElementAt(133, ItPair.first->second.second).GetELink() == ELink)
20050 ReturnPair.first = ItPair.first->second.first;
20051 ReturnPair.second = ItPair.first->second.second;
20052 Route2MultiMapIterator = ItPair.first;
20054 return(ReturnPair);
20057 return(ReturnPair);
20072 AnsiString(VLoc) +
"," + AnsiString(ELink));
20073 THVPair Route2MultiMapKeyPair;
20075 Route2MultiMapKeyPair.first = HLoc;
20076 Route2MultiMapKeyPair.second = VLoc;
20077 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItPair;
20079 ItPair = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20081 if(ItPair.first == ItPair.second)
20087 if(GetFixedRouteAt(205, ItPair.first->second.first).GetFixedPrefDirElementAt(241, ItPair.first->second.second).GetELink() == ELink)
20089 RouteNumber = ItPair.first->second.first;
20095 if(ItPair.first == ItPair.second)
20101 if(GetFixedRouteAt(206, ItPair.first->second.first).GetFixedPrefDirElementAt(242, ItPair.first->second.second).GetELink() == ELink)
20103 RouteNumber = ItPair.first->second.first;
20124 "," + AnsiString(ELinkIn) +
"," + AnsiString(RouteNumber) +
"," + AnsiString(RouteElementNumber));
20125 THVPair Route2MultiMapKeyPair;
20127 Route2MultiMapKeyPair.first = HLoc;
20128 Route2MultiMapKeyPair.second = VLoc;
20131 Route2MultiMapEntry.first = Route2MultiMapKeyPair;
20134 RouteElementPair.first = RouteNumber;
20135 RouteElementPair.second = RouteElementNumber;
20136 Route2MultiMapEntry.second = RouteElementPair;
20138 if(Route2MultiMap.find(Route2MultiMapKeyPair) != Route2MultiMap.end())
20141 if(GetFixedRouteAt(113, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(134,
20142 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).GetELink() != ELinkIn)
20145 if(GetFixedRouteAt(114, Route2MultiMap.find(Route2MultiMapKeyPair)->second.first).GetFixedPrefDirElementAt(135,
20146 Route2MultiMap.find(Route2MultiMapKeyPair)->second.second).TrackType !=
Bridge)
20148 throw Exception(
"Error, bridge expected in Route2MultiMapInsert but not, at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
20150 Route2MultiMap.insert(Route2MultiMapEntry);
20155 throw Exception(
"Error, route map entry found in Route2MultiMapInsert at HLoc=" + AnsiString(HLoc) +
" VLoc=" + AnsiString(VLoc));
20160 Route2MultiMap.insert(Route2MultiMapEntry);
20178 TempPair.first = -1;
20179 TempPair.second = 0;
20180 SecondPair = TempPair;
20182 std::pair<TRoute2MultiMapIterator, TRoute2MultiMapIterator>ItRange;
20183 THVPair Route2MultiMapKeyPair;
20185 Route2MultiMapKeyPair.first = HLoc;
20186 Route2MultiMapKeyPair.second = VLoc;
20187 if(Route2MultiMap.count(Route2MultiMapKeyPair) == 0)
20192 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 1)
20194 Route2MultiMapIterator = Route2MultiMap.find(Route2MultiMapKeyPair);
20196 return(Route2MultiMapIterator->second);
20198 else if(Route2MultiMap.count(Route2MultiMapKeyPair) == 2)
20200 ItRange = Route2MultiMap.equal_range(Route2MultiMapKeyPair);
20201 TempPair = ItRange.first->second;
20202 SecondPair = (--ItRange.second)->second;
20225 TRouteElementPair RouteElementPair = GetRouteElementDataFromRoute2MultiMap(8, CheckElement.
HLoc, CheckElement.
VLoc, SecondPair);
20226 if(RouteElementPair.first == -1)
20229 throw Exception(
"CheckMapAndRoutes Error - failed to find HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" + (AnsiString)CheckElement.
VLoc +
20230 " in Route2MultiMap, Caller=" + (AnsiString)Caller);
20232 if((RouteElementPair.first != (
int)a) && (SecondPair.first != (
int)a))
20235 throw Exception(
"CheckMapAndRoutes Error - RouteNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
20236 (AnsiString)CheckElement.
VLoc +
" Map value=" + (AnsiString)RouteElementPair.first +
" Route value=" + (AnsiString)a +
" Caller=" +
20237 (AnsiString)Caller);
20239 if(((RouteElementPair.first != (
int)a) || (RouteElementPair.second != b)) && ((SecondPair.first != (
int)a) || (SecondPair.second != b)))
20242 throw Exception(
"CheckMapAndRoutes Error - PrefDirVectorNumber failed at HLoc=" + (AnsiString)CheckElement.
HLoc +
" VLoc=" +
20243 (AnsiString)CheckElement.
VLoc +
" 1st Map value RouteNum/ElementNum =" + (AnsiString)RouteElementPair.first +
"/" +
20244 (AnsiString)RouteElementPair.second +
" 2nd Map value =" + (AnsiString)SecondPair.first +
"/" + (AnsiString)SecondPair.second +
20245 " Route value=" + (AnsiString)a +
"/" + (AnsiString)b +
" Caller=" + (AnsiString)Caller);
20249 unsigned int SizeVal = 0;
20252 for(
unsigned int a = 0; a < AllRoutesSize(); a++)
20254 SizeVal += GetFixedRouteAt(117, a).PrefDirSize();
20256 if(SizeVal != Route2MultiMap.size())
20258 throw Exception(
"CheckMapAndRoutes Error - Map Size=" + (AnsiString)Route2MultiMap.size() +
" RouteSize=" + (AnsiString)SizeVal +
" Caller=" +
20259 (AnsiString)Caller);
20275 if(!Route2MultiMap.empty())
20277 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
20279 if(Route2MultiMapIterator->second.first > RouteNumber)
20281 Route2MultiMapIterator->second.first--;
20298 AnsiString(RouteNumber) +
"," + AnsiString(ErasedElementNumber));
20299 if(!Route2MultiMap.empty())
20301 for(
TRoute2MultiMapIterator Route2MultiMapIterator = Route2MultiMap.begin(); Route2MultiMapIterator != Route2MultiMap.end(); Route2MultiMapIterator++)
20303 if((Route2MultiMapIterator->second.first == RouteNumber) && (Route2MultiMapIterator->second.second > ErasedElementNumber))
20305 Route2MultiMapIterator->second.second--;
20324 AnsiString(ELink));
20328 RequiredRoutePair = FindRoutePairFromRoute2MultiMap(0, HLoc, VLoc, ELink, Route2MultiMapIterator);
20329 if(RequiredRoutePair.first == -1)
20331 throw Exception(
"Failed to find route element in RemoveRouteElement");
20333 Route2MultiMap.erase(Route2MultiMapIterator);
20334 DecrementRouteElementNumbersInRoute2MultiMap(0, RequiredRoutePair.first, RequiredRoutePair.second);
20337 TPrefDirElement LockedRouteElement, PrefDirElement = GetFixedRouteAt(118, RequiredRoutePair.first).GetFixedPrefDirElementAt(137, RequiredRoutePair.second);
20358 GetModifiableRouteAt(8, RequiredRoutePair.first).PrefDirVector.erase(GetModifiableRouteAt(33, RequiredRoutePair.first).PrefDirVector.begin() + RequiredRoutePair.second);
20369 if(AutoSigVectorIT->RouteNumber == RequiredRoutePair.first)
20377 if(GetModifiableRouteAt(10, RequiredRoutePair.first).PrefDirSize() == 0)
20379 TrainController->
LogEvent(
"RouteRemoved," + AnsiString(GetFixedRouteAt(189, RequiredRoutePair.first).RouteID));
20380 AllRoutesVector.erase(AllRoutesVector.begin() + RequiredRoutePair.first);
20381 DecrementRouteNumbersInRoute2MultiMap(0, RequiredRoutePair.first);
20393 if(!LockedRouteVector.empty())
20397 if(LRVIT->RouteNumber > RequiredRoutePair.first)
20399 LRVIT->RouteNumber--;
20409 if(AutoSigVectorIT->RouteNumber > RequiredRoutePair.first)
20411 AutoSigVectorIT->RouteNumber--;
20416 CheckMapAndRoutes(7);
20430 AnsiString(ELink) +
"," + AnsiString(RouteNumber) +
"," + RouteElement.
LogPrefDir());
20431 GetModifiableRouteAt(11, RouteNumber).StoreRouteElementInPrefDirVector(RouteElement);
20432 Route2MultiMapInsert(0, HLoc, VLoc, ELink, RouteNumber, GetModifiableRouteAt(12, RouteNumber).
PrefDirSize() - 1);
20449 "," + AnsiString(XLinkPos));
20453 RouteElementPair = GetRouteElementDataFromRoute2MultiMap(9, TE.
HLoc, TE.
VLoc, SecondPair);
20454 if(RouteElementPair.first == -1)
20456 throw Exception(
"Error, failed to find element in SetTrailingSignalsOnAutoSigsRoute - 1");
20458 TPrefDirElement RouteElement = GetFixedRouteAt(119, RouteElementPair.first).GetFixedPrefDirElementAt(138, RouteElementPair.second);
20460 RequiredPair = RouteElementPair;
20461 if(RouteElement.
XLinkPos != XLinkPos)
20463 if(SecondPair.first != -1)
20465 RouteElement = GetFixedRouteAt(120, SecondPair.first).GetFixedPrefDirElementAt(139, SecondPair.second);
20466 RequiredPair = SecondPair;
20467 if(RouteElement.
XLinkPos != XLinkPos)
20469 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 2");
20474 throw Exception(
"Failed to find element in route in SetTrailingSignalsOnAutoSigsRoute - 3");
20478 SetAllRearwardsSignals(5, 0, RequiredPair.first, RequiredPair.second);
20499 AnsiString(AccessNumber));
20501 int Attribute = AccessNumber;
20503 int x = GetFixedRouteAt(121, RouteNumber).PrefDirSize() - 1;
20507 throw Exception(
"Error - route not AutoSignals in SetTrailingSignalsOnContinuationRoute");
20511 throw Exception(
"Error - end element not continuation in SetTrailingSignalsOnContinuationRoute");
20514 x).XLinkPos] !=
End)
20516 throw Exception(
"Error - end element a continuation in SetTrailingSignalsOnContinuationRoute but End not facing right way");
20519 SetAllRearwardsSignals(6, Attribute, RouteNumber, GetFixedRouteAt(126, RouteNumber).
PrefDirSize() - 1);
20570 AnsiString(RouteNumber) +
"," + AnsiString(RouteStartPosition));
20571 TPrefDirElement FirstElement = GetFixedRouteAt(127, RouteNumber).GetFixedPrefDirElementAt(144, 0);
20572 int RearwardLinkedRouteNumber;
20575 bool SkipForwardLook =
false;
20584 SkipForwardLook =
true;
20586 RearwardLinkedRouteNumber).
PrefDirSize() - 1, SkipForwardLook)))
20596 int TrainID, TrainPosition, BehindTrainPosition;
20597 bool FoundTrain =
false, BehindTrain =
false;
20598 for(
int x = RouteStartPosition; x >= 0; x--)
20600 TPrefDirElement PrefDirElement = GetFixedRouteAt(132, RouteNumber).GetFixedPrefDirElementAt(146, x);
20625 if(FoundTrain && (TrainPosition > 1))
20629 for(
int x = TrainPosition; x >= 0; x--)
20633 TPrefDirElement PrefDirElement = GetFixedRouteAt(133, RouteNumber).GetFixedPrefDirElementAt(147, x);
20653 BehindTrain =
true;
20654 BehindTrainPosition = x;
20661 SetAllRearwardsSignals(7, 0, RouteNumber, BehindTrainPosition);
20678 AnsiString(LookBackwardsFromHere));
20679 int SignalCount = 0, TrainID, RearwardLinkedRouteNumber;
20680 TOneRoute CurrentRoute = GetFixedRouteAt(134, RouteNumber);
20683 bool ExamineRoute =
true;
20685 while(ExamineRoute)
20687 for(
int x = LookBackwardsFromHere; x >= 0; x--)
20732 if(SignalCount >= 3)
20747 LookBackwardsFromHere = CurrentRoute.
PrefDirSize() - 1;
20751 CurrentRoute = GetFixedRouteAt(135, RearwardLinkedRouteNumber);
20752 ExamineRoute =
true;
20753 LookBackwardsFromHere = GetFixedRouteAt(136, RearwardLinkedRouteNumber).PrefDirSize() - 1;
20788 ExamineRoute =
false;
20803 AnsiString(TrackVectorPosition) +
"," + AnsiString(XLinkPos));
20806 PrefDirElement = InternalPrefDirElement;
20807 if(LockedRouteVector.empty())
20814 bool InLockedRoute =
false;
20818 if(TrackIsInARoute(14, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos))
20822 InLockedRoute =
true;
20831 int RouteNumber, VectorCount = 0;
20836 RouteType = GetRouteTypeAndNumber(8, LRVIT->LastTrackVectorPosition, LRVIT->LastXLinkPos, RouteNumber);
20837 if(RouteType == NoRoute)
20850 for(
int x = GetFixedRouteAt(141, RouteNumber).
PrefDirSize() - 1; x >= 0; x--)
20852 InternalPrefDirElement = GetFixedRouteAt(142, RouteNumber).GetFixedPrefDirElementAt(152, x);
20857 PrefDirElement = InternalPrefDirElement;
20858 LockedVectorNumber = VectorCount;
20863 else if(InternalPrefDirElement.
TrackVectorPosition == (
int)LRVIT->RearTrackVectorPosition)
20867 PrefDirElement = InternalPrefDirElement;
20868 LockedVectorNumber = VectorCount;
20889 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
20891 if(GetFixedRouteAt(157, x).RouteID ==
RouteID.GetInt())
20897 throw Exception(
"Error, failed to find RouteID in GetRouteVectorNumber for ID: " + AnsiString(
RouteID.GetInt()));
20907 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
20909 if(GetFixedRouteAt(45, x).RouteID ==
RouteID.GetInt())
20924 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
20926 if(GetFixedRouteAt(163, x).RouteID ==
RouteID.GetInt())
20929 return(GetFixedRouteAt(159, x));
20932 throw Exception(
"Error, failed to find RouteID in GetFixedRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
20940 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
20942 if(GetFixedRouteAt(164, x).RouteID ==
RouteID.GetInt())
20945 return(GetModifiableRouteAt(15, x));
20948 throw Exception(
"Error, failed to find RouteID in GetModifiableRouteAtIDNumber for ID: " + AnsiString(
RouteID.GetInt()));
20958 for(
unsigned int x = 0; x < AllRoutesSize(); x++)
20960 TOneRoute OneRoute = GetFixedRouteAt(165, x);
20972 int NumberOfRoutes;
20976 for(
int x = 0; x < NumberOfRoutes; x++)
20983 StoreOneRouteAfterSessionLoad(0, &OneRoute);
21001 if((NumberOfRoutes < 0) || (NumberOfRoutes > 5000))
21008 if((NextID < 0) || (NextID > 1000000))
21013 for(
int x = 0; x < NumberOfRoutes; x++)
21038 AnsiString(StartPosition));
21039 if(EndPosition == StartPosition)
21045 int TVPos = EndPosition;
21046 int LkPos = EndXLinkPos;
21048 while(TrackIsInARoute(15, TVPos, LkPos))
21075 if(GetRouteTypeAndNumber(36, NewTVPos, NewLkPos, RouteNumber) == NoRoute)
21084 if((NewLkPos == 0) || (NewLkPos == 2))
21104 if(TVPos == StartPosition)
21136 AnsiString(VLoc) +
"," + AnsiString(DiagonalLinkNumber));
21141 if(FirstPair.first > -1)
21144 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21149 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21155 if(SecondPair.first > -1)
21158 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21163 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21169 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(0, HLoc - 1, VLoc, 3, TrainID)) || ((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(1, HLoc - 1, VLoc,
21176 if(FirstPair.first > -1)
21179 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21184 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21190 if(SecondPair.first > -1)
21193 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21198 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21204 if(((DiagonalLinkNumber == 1) &&
Track->
TrainOnLink(2, HLoc, VLoc - 1, 7, TrainID)) || ((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(3, HLoc, VLoc - 1,
21211 if(FirstPair.first > -1)
21214 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21219 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21225 if(SecondPair.first > -1)
21228 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21233 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21239 if(((DiagonalLinkNumber == 3) &&
Track->
TrainOnLink(4, HLoc + 1, VLoc, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(5, HLoc + 1, VLoc,
21246 if(FirstPair.first > -1)
21249 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21254 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21260 if(SecondPair.first > -1)
21263 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21268 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21274 if(((DiagonalLinkNumber == 7) &&
Track->
TrainOnLink(6, HLoc, VLoc + 1, 1, TrainID)) || ((DiagonalLinkNumber == 9) &&
Track->
TrainOnLink(7, HLoc, VLoc + 1,
21298 "," + AnsiString(DiagonalLinkNumber));
21303 if(FirstPair.first > -1)
21306 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21311 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21317 if(SecondPair.first > -1)
21320 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21325 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21332 if(FirstPair.first > -1)
21335 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21340 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21346 if(SecondPair.first > -1)
21349 if((DiagonalLinkNumber == 1) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21354 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 9) || (TempPrefDirElement.
XLink == 9)))
21361 if(FirstPair.first > -1)
21364 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21369 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21375 if(SecondPair.first > -1)
21378 if((DiagonalLinkNumber == 3) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21383 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 7) || (TempPrefDirElement.
XLink == 7)))
21390 if(FirstPair.first > -1)
21393 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21398 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))
21404 if(SecondPair.first > -1)
21407 if((DiagonalLinkNumber == 7) && ((TempPrefDirElement.
ELink == 1) || (TempPrefDirElement.
XLink == 1)))
21412 if((DiagonalLinkNumber == 9) && ((TempPrefDirElement.
ELink == 3) || (TempPrefDirElement.
XLink == 3)))